次の方法で共有


NfcAdapter.IsNdefPushEnabled Property

Definition

Return true if the NDEF Push (Android Beam) feature is enabled.

public bool IsNdefPushEnabled { [Android.Runtime.Register("isNdefPushEnabled", "()Z", "")] get; }
[<get: Android.Runtime.Register("isNdefPushEnabled", "()Z", "")>]
member this.IsNdefPushEnabled : bool

Property Value

true if NDEF Push feature is enabled

Attributes

Remarks

Return true if the NDEF Push (Android Beam) feature is enabled.

This function will return true only if both NFC is enabled, and the NDEF Push feature is enabled.

Note that if NFC is enabled but NDEF Push is disabled then this device can still receive NDEF messages, it just cannot send them.

Applications cannot directly toggle the NDEF Push feature, but they can request Settings UI allowing the user to toggle NDEF Push using startActivity(new Intent(Settings.ACTION_NFCSHARING_SETTINGS))

Example usage in an Activity that requires NDEF Push:

protected void onResume() {
                super.onResume();
                if (!nfcAdapter.isEnabled()) {
                    startActivity(new Intent(Settings.ACTION_NFC_SETTINGS));
                } else if (!nfcAdapter.isNdefPushEnabled()) {
                    startActivity(new Intent(Settings.ACTION_NFCSHARING_SETTINGS));
                }
            }

Java documentation for android.nfc.NfcAdapter.isNdefPushEnabled().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also