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 Bilal
  • 542
  • 7
  • 23

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
  • 910,778
  • 176
  • 2,215
  • 2,253
2

Your path will be the URI passed from intent:

Intent intent = getIntent();
String path = intent.getDataString();
Tofeeq Ahmad
  • 11,656
  • 4
  • 58
  • 85