Instant Apps with NFC

后端 未结 1 1361
孤独总比滥情好
孤独总比滥情好 2021-02-07 09:29

I\'m trying to get an instant app to be opened via NFC.

I have something like the below in my AndroidManifest.xml



        
1条回答
  •  野性不改
    2021-02-07 09:48

    Instant apps have a very limited set of allowed permissions and NFC is not in that set. Thus any NFC related intent will not work. Besides, whatever you define on your manifest only works when your app is installed. Which obviously is not the case for instant apps. Google does index the android.intent.action.VIEW intents when you upload your APK to Play Store, so they can make instant app works.

    So when you scan an NFC, it is an android.nfc.action.NDEF_DISCOVERED intent, and therefore your app won't be launched

    However, you still can make it work. Instead of using the link you would normally use to launch your instant app, you should write the link to your instant app on the Play Store to your NFC tag.

    https://play.google.com/store/apps/details?id=&launch=true
    

    Check https://developer.android.com/distribute/marketing-tools/linking-to-google-play#Instant

    0 讨论(0)
提交回复
热议问题