Page 1 of 1

App - continue running in background

Posted: Fri Mar 20, 2015 4:09 am
by M&M

hi,

I have created an app that reads the nfc card data. It works perfectly fine as long as the app is in the foreground. But in my app I invoke another plugin which comes on full screen and when that happens my app (which listens to nfc) stops listening and the built in nfc reader in Android responds.

I believe this is because Android suspends my app the moment something else takes over the screen, even though that 'something' is a plugin that I can calling from within my app. Any solutions?

I believe one solution would be to write some background service. Is there a simpler way for now? I just need my app not to be suspended when i invoke the plugin. Can I fiddle around with the launchmode / intents etc to achieve this?

Thanks,
Murali


App - continue running in background

Posted: Fri Mar 20, 2015 5:28 am
by Bruce Stuart

Murali,

I assume your tried using setInterval ... And called the plugin from inside the interval function ??

Best,
Bruce


App - continue running in background

Posted: Fri Mar 20, 2015 5:48 am
by M&M

hi Bruce,

Yes, I did put up a setinterval and tried writing something to the console. But it stops once I invoke another plugin ( It's a camera plugin.)

Now I am trying out something called the foregroundcamera plugin which presumably doesn't kill (or suspend) the app from where it's called.

Thanks,
Murali


App - continue running in background

Posted: Fri Mar 20, 2015 5:51 am
by M&M

Yes, and I also tried to invoke the plugin in a few different ways, for example I even tried calling it through the nfc initialise / start event. But so far once the camera plugin's up, the nfc falls back to the Android OS default app. I can perhaps try with setting mime types n stuff so that Android may try to 'wake' up my app once a nfc tag is scanned. But doesn't seem elegant enough for me :)

Cheers,
Murali


App - continue running in background

Posted: Fri Mar 20, 2015 5:56 am
by Bruce Stuart

Murali,

Thanks for sharing.... Interesting problem that seems to defy the definition of 'background process'.....

Bruce


App - continue running in background

Posted: Fri Mar 20, 2015 8:15 pm
by Egor Kotov6832188

Hello Murali,

Is there a simpler way for now?

Unfortunately, no.
Appery.io generates hybrid app, which intercommunicates with OS via phonegap plugins, so if you want to launch,kill thread/process, add hardware functionality, then you need to find or write a phonegap plugin, and then integrate it in Appery.io project.