How to check whether BROWSABLE activity is present(installed ) or not?
I am calling my application from clicking on button in web-page. I made that activity as BROWSABLE. It is working fine when I open that web-page in android emulator and click on button; i.e. it is opening the application. Now开发者_StackOverflow中文版, I want to whether that activity is present or not in my emulator i.e. it is installed or not, by clicking on button... How can I check that??
If by "button in web-page" you mean you are using a standard Android browser application, your Web page has no way to determine if the activity is present or not.
What Barcode Scanner and other apps do is:
Have the BROWSABLE activity set with an
<intent-filter>
with a<data>
element that watches for a URL on a site they own.Have that URL resolve to a Web page that explains how to download Barcode Scanner (or whatever the app is)
Then, if the user clicks the link, one of three things will happen:
They will be taken to the Web page, because the app is not installed, and so will now know how to install that app to be able to use that link better in the future
They will be given a "chooser" dialog, to choose between a browser and the recently-installed app. They can choose the app, and optionally check the "make this the default action" checkbox
They will be taken straight to the app, because they checked the checkbox mentioned in the previous bullet
精彩评论