https://github.com/katzer/cordova-plugin-background-mode
实际试验不行,看issues中的贡献者回复:
This plugin was never meant to run while the app is closed. It is not a service, it’s just trying to keep the app alive.
该插件不是一个服务,因此无法实现
参考:
https://blog.csdn.net/robert_cysy/article/details/54097206
https://stackoverflow.com/questions/10343828/creating-an-android-service-with-phonegap-have-phonegap-app-run-even-when-clos
https://blog.csdn.net/crissjs/article/details/38293441
参考项目:
https://github.com/ToniKorin/cordova-plugin-location-provider/blob/master/src/android/LocationService.java