M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

App - continue running in background

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

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

App - continue running in background

Murali,

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

Best,
Bruce

M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

App - continue running in background

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

M&M
Posts: 0
Joined: Tue Nov 11, 2014 6:59 am

App - continue running in background

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

Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

App - continue running in background

Murali,

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

Bruce

Egor Kotov6832188
Posts: 0
Joined: Wed Nov 19, 2014 5:15 pm

App - continue running in background

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.

Return to “Issues”