How to run background service in PhoneGap ?

  • 1
  • Question
  • Updated 5 years ago
  • Answered
Hello all,

I'm trying to run background service using the PhoneGap background mode. But it seems it doesn't work well when user manually close the application from the Task Manager. So, I decided to use BackGround service plugin. https://build.phonegap.com/plugins/1041

Documentation : https://github.com/Red-Folder/Cordova...

Here I have to add files manually in the different folders it means .jar file, .java file and I also need to AndroidManifest.xml file.

I compile code using https://build.phonegap.com. However it says to add only www files as Background service plugin uses the external .jar and .JAVA file, How to compile this code ?

Thank you!
Photo of Abhishek Deshkar

Abhishek Deshkar

  • 48 Posts
  • 0 Reply Likes

Posted 5 years ago

  • 1
Photo of Yi Ming Kuan

Yi Ming Kuan

  • 1840 Posts
  • 78 Reply Likes
PhoneGap Build only supports plugins hosted on NPM (http://plugins.cordova.io/npm/index.html) and on PGB itself (https://build.phonegap.com/plugins).

Given the nature of the Background Service plugin requiring some manual customization with native code, it's unlikely this plugin will work with PhoneGap Build any time soon. You'll have to make your own plugin by forking this code (https://github.com/Red-Folder/bgs-core) on a local build instead.

-yiming
Photo of Abhishek Deshkar

Abhishek Deshkar

  • 48 Posts
  • 0 Reply Likes
Any example of this plugin ? Is there any example ?
Photo of Yi Ming Kuan

Yi Ming Kuan

  • 1840 Posts
  • 78 Reply Likes
Example implementation: https://github.com/Red-Folder/bgs-sample

Refer to the readme at https://github.com/Red-Folder/bgs-core

If you need further assistance with setting this up for local builds, you can post your questions here: https://groups.google.com/forum/#!forum/phonegap

-yiming