how to run the android phonegap application in background(after closing the application)?

后端 未结 2 789
囚心锁ツ
囚心锁ツ 2021-02-09 05:18

I have used the system notification plugin from the github(https://github.com/saileshmittal/phonegap-system-notification-plugin) for android phonegap.I have used this code in my

相关标签:
2条回答
  • 2021-02-09 06:07

    According to the phonegap documentation you cannot run the apps in the background, the js cannot continue to run. The reason notifications are able to work is because they are using the native system to send the notifications.

    In order to make processes run in the background you will need to create a plugin that uses the native os.

    0 讨论(0)
  • 2021-02-09 06:09

    I made an Android application with PhoneGap and when I press the home button, my application stays in background (with my last test it stays more than 1 hour). But when I launch other App the Android OS kills my application.

    To enable this behaviour you need to add the android permission:

    <uses-permission android:name="android.permission.WAKE_LOCK" /> to your manifest

    and you also need to add:

    <preference name="exit-on-suspend" value="false" /> to your config.xml in folder res/xml

    I hope this post can you help you :)

    0 讨论(0)
提交回复
热议问题