Android Beam - fallback when my app is not installed

微笑、不失礼 提交于 2019-12-05 07:59:03

问题


I've had a play with the Android Beam sample code and have it working with two devices, sending a string of text. However, if the recipient doesn't have the app installed, my tag is simply collected for use at a later date.

It is possible in some way to take the user to the Android Market if my app is not installed, and to process the data in the intent if it is installed?


回答1:


There is a piece of commented code in the Beam sample that already has the application record set up for you. Just uncomment it and see if that is the behavior you want.




回答2:


To make it work on pre-ICS devices, you can send an NDEF message that consists of 3 records: 1) The Market URL of the app in a URI record (or SmartPoster record) 2) The data you want to Beam 3) The Android Application Record for your app When you add an Intent filter to the Android Manifest file to filter for the Market URL (on pre-ICS devices) in an ACTION_NDEF_DISCOVERED Intent, your app will be started if it is installed and otherwise the Market app will be opened.



来源:https://stackoverflow.com/questions/9178129/android-beam-fallback-when-my-app-is-not-installed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!