/// <summary>Enables NFC Reading and Writing</summary> public static void Enable() { NativeNFC nativeNFC = Instance.nfc; if (!nativeNFC.IsNFCEnabled()) { Debug.LogWarning("NFC is not enabled on this device, you might want to notify the user. The current NFC state can be checked with the \'IsNFCEnabled()\' method."); } nativeNFC.Enable(); }
private void Awake() { #if UNITY_EDITOR Debug.LogWarning("Native NFC can't be accessed in the Editor"); #elif UNITY_ANDROID nfc = gameObject.AddComponent <AndroidNFC>(); nfc.Initialize(); #elif UNITY_IOS nfc = gameObject.AddComponent <IOSNFC>(); nfc.Initialize(); #else Debug.LogWarning("Native NFC is only supported on Android"); #endif }
/// <summary>Checks if NDEF Write is supported on this device</summary> public static bool IsNDEFWriteSupported() { NativeNFC nativeNFC = Instance.nfc; return(nativeNFC.IsNDEFWriteSupported()); }
/// <summary>Checks if NFC Tag Info Read is supported on this device</summary> public static bool IsNFCTagInfoReadSupported() { NativeNFC nativeNFC = Instance.nfc; return(nativeNFC.IsNFCTagInfoReadSupported()); }
/// <summary>Shows the NFC Settings on the device (if available)</summary> public static void ShowNFCSettings() { NativeNFC nativeNFC = Instance.nfc; nativeNFC.ShowNFCSettings(); }
/// <summary>Adds given OnNDEFPushFinished listener</summary> public static void RemoveNDEFPushFinishedListener(OnNDEFPushFinished listener) { NativeNFC nativeNFC = Instance.nfc; nativeNFC.NDEFPushFinished -= listener; }
/// <summary>Adds given OnNDEFWriteFinished listener</summary> public static void AddNDEFWriteFinishedListener(OnNDEFWriteFinished listener) { NativeNFC nativeNFC = Instance.nfc; nativeNFC.NDEFWriteFinished += listener; }
/// <summary>Removes given OnNFCTagDetected listener</summary> public static void RemoveNFCTagDetectedListener(OnNFCTagDetected listener) { NativeNFC nativeNFC = Instance.nfc; nativeNFC.NFCTagDetected -= listener; }
/// <summary>Cancel pending NDEF Message push request (if any)</summary> public static void CancelNDEFPushRequest() { NativeNFC nativeNFC = Instance.nfc; nativeNFC.CancelNDEFPushRequest(); }
/// <summary>Start a push request for given NDEF Message</summary> public static void RequestNDEFPush(NDEFMessage message) { NativeNFC nativeNFC = Instance.nfc; nativeNFC.RequestNDEFPush(message.ToJSON().ToString()); }
/// <summary>Disables NFC Reading and Writing</summary> public static void Disable() { NativeNFC nativeNFC = Instance.nfc; nativeNFC.Disable(); }
/// <summary>Checks if NDEF Push is currently enabled on this device</summary> public static bool IsNDEFPushEnabled() { NativeNFC nativeNFC = Instance.nfc; return(nativeNFC.IsNDEFPushEnabled()); }
/// <summary>Enables NFC Reading and Writing</summary> public static void Enable() { NativeNFC nativeNFC = Instance.nfc; nativeNFC.Enable(); }