Search code examples
androidandroid-intentnfcforeground

Differences b/w Intent dispatch system and Foreground dispatch system


Can anyone tell the differences between Foreground dispatch system and Intent dispatch system? when should i go for Foreground dispatch system?


Solution

  • The intent dispatch system is to launch a program from scratch. For instance, you turn your phone on and hover it over a tag. The phone launches an intent, identifying it as a Mifare card. Your app has an intent dispatch for Mifare cards, so it is one of the apps that can be selected. If your intent dispatch is specific enough(compared to other apps), it will be the only app to select, and will run at that point.

    Foreground dispatch is used by your app while it is running. This way, your app won't be turned off if another app has a similar intent dispatch setup. Now with your app running, it can discover a tag and handle the intent over other apps on the phone, and the phone will not prompt you to select from a bunch of apps that have a similar intent dispatch.

    I hope that was not to confusing!