如何使 phonegap 构建应用程序在后台运行
How to make a phonegap build app work in background
我需要我的应用程序 24/7 工作,每 5 分钟记录一次用户位置。它在 phone 处于活动状态时工作正常,但当它不是 setInterval()
时,它的长度比它们应该长 5 倍。
使用 phonegap 构建,当 phone 处于空闲状态时,我将如何让应用程序在后台正常运行?
@马蒂,
Android 和 iOS 以及 运行 都在后台,但需要对常规 config.xml 进行扩展。
要清楚 Android 应用程序使用 AndriodManifest.xml。
iOS 使用,preferences.plist
两者都有进入后台的能力。但是,在Cordova/Phonegap中不能直接使用,必须进行扩展。最好的解释来自 Cordova 和 Phonegap Build。
来自 Phonegap 版本:
开始于:Config File Elements。您需要为每个添加 <gap:config-file>
个,然后您还需要添加到第一个 xml 元素,如下所示:
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:android = "http://schemas.android.com/apk/res/android"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.bsdmasterindex.googlemapexamples"
version = "1.0.0"
versionCode = "10" >
最重要的项目是 xmlns:android = "http://schemas.android.com/apk/res/android"
。当然,这仅适用于 android。
我的 Phonegap Build 演示锅炉板中有使用它的示例 - 源代码可在 git 中心获得。
Three (3) Phonegap Build Boilerplates for For Android and iO
您将需要查看样板 #2。
这篇文章会有所帮助。
7 things you should know about Android Manifest xml file
如果你有进一步的问题,我建议你去google groups。我很快就会从我的准备列表中删除 Whosebug。我可能会在星期一放弃。
杰西
我需要我的应用程序 24/7 工作,每 5 分钟记录一次用户位置。它在 phone 处于活动状态时工作正常,但当它不是 setInterval()
时,它的长度比它们应该长 5 倍。
使用 phonegap 构建,当 phone 处于空闲状态时,我将如何让应用程序在后台正常运行?
@马蒂,
Android 和 iOS 以及 运行 都在后台,但需要对常规 config.xml 进行扩展。
要清楚 Android 应用程序使用 AndriodManifest.xml。 iOS 使用,preferences.plist
两者都有进入后台的能力。但是,在Cordova/Phonegap中不能直接使用,必须进行扩展。最好的解释来自 Cordova 和 Phonegap Build。
来自 Phonegap 版本:
开始于:Config File Elements。您需要为每个添加 <gap:config-file>
个,然后您还需要添加到第一个 xml 元素,如下所示:
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:android = "http://schemas.android.com/apk/res/android"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.bsdmasterindex.googlemapexamples"
version = "1.0.0"
versionCode = "10" >
最重要的项目是 xmlns:android = "http://schemas.android.com/apk/res/android"
。当然,这仅适用于 android。
我的 Phonegap Build 演示锅炉板中有使用它的示例 - 源代码可在 git 中心获得。
Three (3) Phonegap Build Boilerplates for For Android and iO
您将需要查看样板 #2。
这篇文章会有所帮助。 7 things you should know about Android Manifest xml file
如果你有进一步的问题,我建议你去google groups。我很快就会从我的准备列表中删除 Whosebug。我可能会在星期一放弃。
杰西