Tuesday, 20 August 2013

How to determine if a phonegap android activity is already running

How to determine if a phonegap android activity is already running

I have an android nfc reading application developed using phonegap. The
application detects which mimetype was scaned and launches the app with
the relevant file loaded.
if(receivedType.endsWith("/one")){
super.loadUrl("file:///android_asset/www/index.html");
}else if(receivedType.endsWith("/two")){
super.loadUrl("file:///android_asset/www/other/index.html");
}
problem is that on the first time of detecting mimetype onethe app
launches as desired, scan another tag with the same mimetype then the app
attempt to relauch and crashes. I would like to detect if the app is
already running and prevent the relaunch attempt.

No comments:

Post a Comment