Search code examples
androidnfcandroid-beam

Android Beam - activate programmatically


I try to activate or deactivate the Android Beam feature programmatically on ICS but I can't find any api for this. Is it possible ?

And I would know if Android Beam feature is enabled before initiate a push operation. Is it possible ?


Solution

  • In the phone's Settings you can enable and disable the Android Beam feature (Wireless Networks -> More... -> Android Beam). Normal apps do not have the necessary permission to turn this on or off (and there is no API). You can, however, send and Intent from your app to open this Settings screen directly, using new Intent(Settings.ACTION_WIRELESS_SETTINGS).

    On Android 4.1 JB, a new API call was added, NfcAdapter.isNdefPushEnabled(), to check whether Android Beam is turned on or off.

    BTW: Even if Android Beam is disabled, your device will still be able to receive Beam messages, as long as NFC is turned on.