chariotsolutions / phonegap-nfc

PhoneGap NFC Plugin
MIT License
706 stars 564 forks source link

After scanning a tag, pushing the home button and starting the app again: the app is created again and not resumed #73

Closed FrancescoFreder closed 11 years ago

FrancescoFreder commented 11 years ago

Hello, i have an issue on my nexus 7 with android 4.2.2 using the last versions of phonegap (2.5.) and phonegap-nfc (0.4.1). when using the homebutton, the app is recreated again and not resumed. but the other state is still there and available as soon as i exit from the application (as if it is started twice). i've broken this down using only the reader demo. this problem only occurres if a tag is scanned.

I can reproduce it with phonegap-nrc-reader-demo in that way:

you can the on the logs that the app is created (see logs below). if you exit the application now, the application is still available with the old data).


logs for resuming the app WITHOUT scanning a tag:

03-19 11:19:00.714: D/DroidGap(26662): Resuming the App 03-19 11:19:00.714: D/NfcPlugin(26662): onResume Intent { }


logs for resuming the app and a tag is scanned before:

03-19 11:20:45.064: D/DroidGap(26662): DroidGap.onCreate() 03-19 11:20:45.074: D/JsMessageQueue(26662): Set native->JS mode to 2 03-19 11:20:45.074: D/DroidGap(26662): DroidGap.init() 03-19 11:20:45.084: D/CordovaWebView(26662): >>> loadUrl(file:///android_asset/www/index.html) 03-19 11:20:45.084: D/PluginManager(26662): init() 03-19 11:20:45.084: D/CordovaWebView(26662): >>> loadUrlNow() 03-19 11:20:45.084: D/DroidGap(26662): Resuming the App 03-19 11:20:45.094: D/DroidGap(26662): onMessage(onPageStarted,file:///android_asset/www/index.html) 03-19 11:20:45.104: D/SoftKeyboardDetect(26662): Ignore this event 03-19 11:20:45.134: D/CordovaLog(26662): Viewport argument value "320;" for key "width" was truncated to its numeric prefix. 03-19 11:20:45.134: V/Web Console(26662): Viewport argument value "320;" for key "width" was truncated to its numeric prefix. at file:///android_asset/www/index.html:4 03-19 11:20:45.194: D/Cordova(26662): onPageFinished(file:///android_asset/www/index.html) 03-19 11:20:45.194: D/Cordova(26662): Trying to fire onNativeReady 03-19 11:20:45.204: D/DroidGap(26662): onMessage(onNativeReady,null) 03-19 11:20:45.204: D/DroidGap(26662): onMessage(onPageFinished,file:///android_asset/www/index.html) 03-19 11:20:45.214: D/SoftKeyboardDetect(26662): Ignore this event 03-19 11:20:45.264: D/NfcPlugin(26662): execute init 03-19 11:20:45.264: D/NfcPlugin(26662): Enabling plugin Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.chariotsolutions.nfc.demo.reader/.ReaderDemo bnds=[272,595][400,723] } 03-19 11:20:45.274: D/CordovaLog(26662): Initialized the NfcPlugin 03-19 11:20:45.274: I/Web Console(26662): Initialized the NfcPlugin at file:///android_asset/www/phonegap-nfc-0.4.1.js:7 03-19 11:20:45.284: D/NfcPlugin(26662): parseMessage Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.chariotsolutions.nfc.demo.reader/.ReaderDemo bnds=[272,595][400,723] } 03-19 11:20:45.284: D/NfcPlugin(26662): action android.intent.action.MAIN 03-19 11:20:45.294: D/CordovaNetworkManager(26662): Connection Type: wifi 03-19 11:20:45.294: D/DroidGap(26662): onMessage(networkconnection,wifi) 03-19 11:20:45.294: D/CordovaNetworkManager(26662): Connection Type: wifi 03-19 11:20:45.294: D/DroidGap(26662): onMessage(spinner,stop) 03-19 11:20:45.304: D/NfcPlugin(26662): execute registerNdef 03-19 11:20:45.304: D/NfcPlugin(26662): execute registerMimeType 03-19 11:20:45.314: D/CordovaLog(26662): Listening for NDEF tags. 03-19 11:20:45.314: I/Web Console(26662): Listening for NDEF tags. at file:///android_asset/www/main.js:116 03-19 11:20:45.314: D/CordovaLog(26662): Listening for NDEF mime tags with type text/pg. 03-19 11:20:45.314: I/Web Console(26662): Listening for NDEF mime tags with type text/pg. at file:///android_asset/www/main.js:128 03-19 11:20:47.214: D/DroidGap(26662): onMessage(spinner,stop)

don commented 11 years ago

Thanks for reporting. Since this is a problem with the demo, I'm creating the bug in that repo https://github.com/don/phonegap-nfc-reader/issues/3