语言

NfcAdapter.DisableForegroundNdefPush(Activity) 方法

定义

注意

deprecated

禁用通过 P2P 推送 NDEF 消息。

[Android.Runtime.Register("disableForegroundNdefPush", "(Landroid/app/Activity;)V", "")]
[System.Obsolete("deprecated")]
public void DisableForegroundNdefPush(Android.App.Activity? activity);
[<Android.Runtime.Register("disableForegroundNdefPush", "(Landroid/app/Activity;)V", "")>]
[<System.Obsolete("deprecated")>]
member this.DisableForegroundNdefPush : Android.App.Activity -> unit

参数

activity
Activity

前台活动

特性

例外

如果活动已暂停,则为

注解

禁用通过 P2P 推送 NDEF 消息。

调用 #enableForegroundNdefPush后,活动必须在回调 Activity#onPause 完成之前调用此方法。

强烈建议改用新 #setNdefPushMessage 项:它会自动挂钩到活动生命周期中,因此无需在 onResume/onPause 中调用 enable/disable。

必须从主线程调用此方法。

需要 android.Manifest.permission#NFC 权限。

Java文档android.nfc.NfcAdapter.disableForegroundNdefPush(android.app.Activity)。

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于