NfcAdapter.InvokeBeam(Activity) Method

Definition

Manually invoke Android Beam to share data.

[Android.Runtime.Register("invokeBeam", "(Landroid/app/Activity;)Z", "")]
public bool InvokeBeam (Android.App.Activity? activity);
[<Android.Runtime.Register("invokeBeam", "(Landroid/app/Activity;)Z", "")>]
member this.InvokeBeam : Android.App.Activity -> bool

Parameters

activity
Activity

the current foreground Activity that has registered data to share

Returns

whether the Beam animation was successfully invoked

Attributes

Remarks

Manually invoke Android Beam to share data.

The Android Beam animation is normally only shown when two NFC-capable devices come into range. By calling this method, an Activity can invoke the Beam animation directly even if no other NFC device is in range yet. The Beam animation will then prompt the user to tap another NFC-capable device to complete the data transfer.

The main advantage of using this method is that it avoids the need for the user to tap the screen to complete the transfer, as this method already establishes the direction of the transfer and the consent of the user to share data. Callers are responsible for making sure that the user has consented to sharing data on NFC tap.

Note that to use this method, the passed in Activity must have already set data to share over Beam by using method calls such as #setNdefPushMessageCallback or #setBeamPushUrisCallback.

Java documentation for android.nfc.NfcAdapter.invokeBeam(android.app.Activity).

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