2

In my android app I want to associate my app with *.bin extension. Whenever a user click on a *.bin file, I want my app to be started and make a conversion. This link shows associating process, but when the app is onCreate, how can I get the file, its path, etc?

I couldn't find how to do that. Thanks in advance.

Community
  • 1
  • 1
Sertalp B. Cay
  • 552
  • 7
  • 24

2 Answers2

4

when the app is onCreate, how can I get the file, its path, etc?

Call getIntent().getData() in your Activity to retrieve the Uri that represents the file or URL that you are to open.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
2

Your path will be the URI passed from intent:

Intent intent = getIntent();
String path = intent.getDataString();
Tofeeq Ahmad
  • 11,935
  • 4
  • 61
  • 87