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

            return(nativeNFC.IsNDEFWriteSupported());
        }
예제 #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());
        }
예제 #5
0
        /// <summary>Shows the NFC Settings on the device (if available)</summary>
        public static void ShowNFCSettings()
        {
            NativeNFC nativeNFC = Instance.nfc;

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

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

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

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

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

            nativeNFC.Disable();
        }
예제 #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());
        }
예제 #13
0
        /// <summary>Enables NFC Reading and Writing</summary>
        public static void Enable()
        {
            NativeNFC nativeNFC = Instance.nfc;

            nativeNFC.Enable();
        }