gpt4 book ai didi

android - Phonegap 应用程序在收集位置时在后台死机

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:41:00 27 4
gpt4 key购买 nike

我有一个内置于 PhoneGap 中的应用程序,它利用 navigator.geolocation 调用来跟踪移动设备的坐标。用户可以控制跟踪的开始和结束。该应用程序旨在在后台接收坐标更新。该应用程序针对 Android 和 iOS 设备发布。

Android 版本在后台时似乎很容易崩溃。在某些手机上它运行良好,但在很多手机上,该应用程序本应在后台收集坐标数据时就会死掉。我在下面发布了一个 LogCat 日志。似乎在 Activity 管理器在进程上调用“不再需要”之后不久,CCWalkerActivity 上发生了 WIN DEATH(两者都在下面以粗体显示)。但是,我无法确定为什么会发生这种情况以及为什么它发生得如此频繁。

这是 Phonegap 的问题吗?创建一个可以处理前台服务(使用 startForeground())的插件是否有益?

10-19 14:50:12.439 D/dalvikvm(  496): GC_CONCURRENT freed 1917K, 28% free 12417K/17031K, external 11622K/13670K, paused 12ms+10ms10-19 14:50:13.040 D/CordovaLog( 6275): isGPSEnabled succeeded, accuracy: 1210-19 14:50:13.040 D/CordovaLog( 6275): file:///android_asset/www/lib.js: Line 24 : isGPSEnabled succeeded, accuracy: 1210-19 14:50:13.040 I/Web Console( 6275): isGPSEnabled succeeded, accuracy: 12 at file:///android_asset/www/lib.js:2410-19 14:50:13.072 D/CordovaLog( 6275): collectLocationData success: 1210-19 14:50:13.072 D/CordovaLog( 6275): file:///android_asset/www/lib.js: Line 24 : collectLocationData success: 1210-19 14:50:13.072 I/Web Console( 6275): collectLocationData success: 12 at file:///android_asset/www/lib.js:2410-19 14:50:14.072 D/WifiLocator(  976): Too many no-location APs. Will not compute a location nor go to the server. hasLocation=0 noLocation=0 cacheMiss=010-19 14:50:14.072 D/CellLocator(  976): Found cell location: Position [redacted]10-19 14:50:14.072 D/androidNlpServiceThread(  976): reporting Location[mProvider=network,mTime=1350672614078,mLatitude=40.8390777,mLongitude=-73.6949326,mHasAltitude=false,mAltitude=0.0,mHasSpeed=false,mSpeed=0.0,mHasBearing=false,mBearing=0.0,mHasAccuracy=true,mAccuracy=1123.0,mExtras=Bundle[{networkLocationSource=cached, networkLocationType=cell}]]10-19 14:50:14.087 D/libgps  (  496): GpsInterface_inject_location( 40.839078, -73.694933, 1123.000 )10-19 14:50:14.087 D/libgps  (  496): MPDINJPOS_REQ msg id 1201510-19 14:50:14.087 D/ClientReporter(  976): reported location10-19 14:50:14.095 D/CordovaLog( 6275): collectLocationData success: 112310-19 14:50:14.095 D/CordovaLog( 6275): file:///android_asset/www/lib.js: Line 24 : collectLocationData success: 112310-19 14:50:14.095 I/Web Console( 6275): collectLocationData success: 1123 at file:///android_asset/www/lib.js:2410-19 14:50:14.118 D/androidNlpServiceThread(  976): adding listener com.google.android.location.internal.client.NetworkLocationClient$1@40552710 with period 4510-19 14:50:14.118 D/androidNetworkLocationListeners(  976): Still have listener com.google.android.location.internal.client.NetworkLocationClient$1@4055271010-19 14:50:14.118 I/ActivityManager(  496): No longer want com.CCtracks.CCWalker (pid 6275): hidden #2110-19 14:50:14.126 D/WifiLocator(  976): Too many no-location APs. Will not compute a location nor go to the server. hasLocation=0 noLocation=0 cacheMiss=010-19 14:50:14.126 D/CellLocator(  976): Found cell location: Position [redacted]10-19 14:50:14.126 D/androidNlpServiceThread(  976): reporting Location[mProvider=network,mTime=1350672614137,mLatitude=40.8390777,mLongitude=-73.6949326,mHasAltitude=false,mAltitude=0.0,mHasSpeed=false,mSpeed=0.0,mHasBearing=false,mBearing=0.0,mHasAccuracy=true,mAccuracy=1123.0,mExtras=Bundle[{networkLocationSource=cached, networkLocationType=cell}]]10-19 14:50:14.134 D/ClientReporter(  976): reported location10-19 14:50:14.204 I/WindowManager(  496): WIN DEATH: Window{405a97d0 com.CCtracks.CCWalker/com.CCtracks.CCWalker.CCWalkerActivity paused=false}10-19 14:50:14.228 D/androidNlpServiceThread(  976): adding listener com.google.android.location.internal.client.NetworkLocationClient$1@40552710 with period 8640010-19 14:50:14.228 D/androidNetworkLocationListeners(  976): Still have listener com.google.android.location.internal.client.NetworkLocationClient$1@4055271010-19 14:50:14.236 D/WifiLocator(  976): Too many no-location APs. Will not compute a location nor go to the server. hasLocation=0 noLocation=0 cacheMiss=010-19 14:50:14.236 D/CellLocator(  976): Found cell location: Position [redacted]10-19 14:50:14.236 D/androidNlpServiceThread(  976): reporting Location[mProvider=network,mTime=1350672614246,mLatitude=40.8390777,mLongitude=-73.6949326,mHasAltitude=false,mAltitude=0.0,mHasSpeed=false,mSpeed=0.0,mHasBearing=false,mBearing=0.0,mHasAccuracy=true,mAccuracy=1123.0,mExtras=Bundle[{networkLocationSource=cached, networkLocationType=cell}]]10-19 14:50:14.243 D/ClientReporter(  976): reported location10-19 14:50:14.595 W/GpsLocationProvider(  496): Unneeded remove listener for uid 100010-19 14:50:14.595 D/libgps_GpsMgr(  496): schedGps() mode: 3, tbf: 0, accuracy: 0, perf: 0, pAgps: null10-19 14:50:14.595 D/libgps  (  496): GpsInterface_stop()10-19 14:50:14.603 D/libgps  (  496): action_thread_main(): BP not in session, sending fake END callback10-19 14:50:14.603 D/libgps  (  496): status_cb: GPS_STATUS_SESSION_END (2)10-19 14:50:14.603 D/libgps_GpsMgr(  496): sched() set mode: 3, tbf: 010-19 14:50:14.634 D/libgps  (  496): GpsInterface_inject_location( 40.839078, -73.694933, 1123.000 )10-19 14:50:14.634 D/libgps  (  496): MPDINJPOS_REQ msg id 12015

最佳答案

如果您的应用进程在前台或前台服务中没有任何 Activity ,系统可以随时终止它以释放内存供其他应用使用。

因此,在您的情况下,当用户使用例如主页按钮离开您的应用程序时调用 Activity.onPause 后,您的应用程序进程可以随时终止。

http://developer.android.com/guide/components/processes-and-threads.html#Lifecycle

关于android - Phonegap 应用程序在收集位置时在后台死机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12982079/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com