Run Android phonegap application in background

妖精的绣舞 提交于 2019-12-07 02:13:37

问题


I am developing an android application in Phonegap, cordova.. I had a button in the application, while clicking in that I need to run the application in the background and

need to call a web service at the interval of 15 mins.

Is it possible in phone gap, cordova proj...

I am new to this..Please help


回答1:


You will have to create a custom plugin in order to run processes in the background. You can find a plugin implementation here.




回答2:


In the onCreate method of your Java class that extends from DroidGap make sure you have set "keepRunning" properly.

        super.setBooleanProperty("keepRunning", true);



回答3:


As of phonegap 3+, there's a plugin to add this functionality to your application, here's the link to the plugin project and instructions, should work for cordova, phonegap and phonegap build:

https://github.com/katzer/cordova-plugin-background-mode/blob/ac5fef831dbf9e567277dc900389923bd9bc7714/README.md



来源:https://stackoverflow.com/questions/12229896/run-android-phonegap-application-in-background

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!