Application type: mobile Titanium SDK: 3.1.3.GA Platform & version: Android 4+ Device: Any physical Android device Host Operating System: OSX 10.9.3 Titanium Studio, build: 3.3.0.201407100905
Hi, I have a problem using NFC and Push notifications together. I hope somebody can help me with this problem. When the application boots the regular way NFC works fine without exception. The log creates the following message:
07-30 13:58:00.216: D/NfcDispatcher(616): dispatch tag: TAG: Tech [android.nfc.tech.NfcA] message: null 07-30 13:58:00.226: I/NfcDispatcher(616): matched TECH override 07-30 13:58:00.236: I/Nfc Module(12105): android.nfc.action.TECH_DISCOVERED intent received with no messagesBut when the app is launched from a push notification the log creates the following message:
07-30 13:57:31.721: D/NfcDispatcher(616): dispatch tag: TAG: Tech [android.nfc.tech.NfcA] message: null 07-30 13:57:31.726: I/NfcDispatcher(616): matched TECH override 07-30 13:57:32.336: D/NativeNfcTag(616): Tag lost, restarting polling loopThe following code is used to activate NFC:
function setupNFC(){ nfcAdapter = nfc.createNfcAdapter({ onNdefDiscovered:handleDiscovery, onTagDiscovered:handleDiscovery, onTechDiscovered:handleDiscovery }); if(!nfcAdapter.isEnabled()) { alert("No NFC today!"); return; }; act = Ti.Android.currentActivity; Titanium.API.info(JSON.stringify(act)); act.addEventListener('newintent', function(e){ nfcAdapter.onNewIntent(e.intent); }); dispatchFilter = nfc.createNfcForegroundDispatchFilter({ intentFilters: [ { action: nfc.ACTION_TECH_DISCOVERED, mimeType: '*/*' }, { action: nfc.ACTION_TECH_DISCOVERED, scheme: 'http' }, ], techLists: [ [ "android.nfc.tech.NfcA" ], [ "android.nfc.tech.Ndef" ], [ "android.nfc.tech.NdefFormatable" ], [ "android.nfc.tech.MifareClassic" ] ] }); nfcAdapter.enableForegroundDispatch(dispatchFilter); };