Example #1
0
        /// <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();
        }
Example #2
0
        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
        }
Example #3
0
        /// <summary>Checks if NDEF Write is supported on this device</summary>
        public static bool IsNDEFWriteSupported()
        {
            NativeNFC nativeNFC = Instance.nfc;

            return(nativeNFC.IsNDEFWriteSupported());
        }
Example #4
0
        /// <summary>Checks if NFC Tag Info Read is supported on this device</summary>
        public static bool IsNFCTagInfoReadSupported()
        {
            NativeNFC nativeNFC = Instance.nfc;

            return(nativeNFC.IsNFCTagInfoReadSupported());
        }
Example #5
0
        /// <summary>Shows the NFC Settings on the device (if available)</summary>
        public static void ShowNFCSettings()
        {
            NativeNFC nativeNFC = Instance.nfc;

            nativeNFC.ShowNFCSettings();
        }
Example #6
0
        /// <summary>Adds given OnNDEFPushFinished listener</summary>
        public static void RemoveNDEFPushFinishedListener(OnNDEFPushFinished listener)
        {
            NativeNFC nativeNFC = Instance.nfc;

            nativeNFC.NDEFPushFinished -= listener;
        }
Example #7
0
        /// <summary>Adds given OnNDEFWriteFinished listener</summary>
        public static void AddNDEFWriteFinishedListener(OnNDEFWriteFinished listener)
        {
            NativeNFC nativeNFC = Instance.nfc;

            nativeNFC.NDEFWriteFinished += listener;
        }
Example #8
0
        /// <summary>Removes given OnNFCTagDetected listener</summary>
        public static void RemoveNFCTagDetectedListener(OnNFCTagDetected listener)
        {
            NativeNFC nativeNFC = Instance.nfc;

            nativeNFC.NFCTagDetected -= listener;
        }
Example #9
0
        /// <summary>Cancel pending NDEF Message push request (if any)</summary>
        public static void CancelNDEFPushRequest()
        {
            NativeNFC nativeNFC = Instance.nfc;

            nativeNFC.CancelNDEFPushRequest();
        }
Example #10
0
        /// <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());
        }
Example #11
0
        /// <summary>Disables NFC Reading and Writing</summary>
        public static void Disable()
        {
            NativeNFC nativeNFC = Instance.nfc;

            nativeNFC.Disable();
        }
Example #12
0
        /// <summary>Checks if NDEF Push is currently enabled on this device</summary>
        public static bool IsNDEFPushEnabled()
        {
            NativeNFC nativeNFC = Instance.nfc;

            return(nativeNFC.IsNDEFPushEnabled());
        }
Example #13
0
        /// <summary>Enables NFC Reading and Writing</summary>
        public static void Enable()
        {
            NativeNFC nativeNFC = Instance.nfc;

            nativeNFC.Enable();
        }