radshag / PhoneGap-Geofencing

Geofencing Plugin For Phonegap
95 stars 56 forks source link

Android: startMonitoringSignificantLocationChanges fails if app starts from installation process #16

Open andreground opened 11 years ago

andreground commented 11 years ago

Hi, First of all, thanks @radshag for your precious contribution.

I've successfuly implemented your plugin in my application but I've noticed a strange behaviour. When using the startMonitoringSignificantLocationChanges function attached to the onDeviceReady event, the function returns "failed" if the app has been started right at the end of the installation process.

Then, if the app is closed and then started from the app menu, everything works fine.

radshag commented 11 years ago

Thanks

I will look into this.

On 13 במרץ 2013, at 11:57, andreground notifications@github.com wrote:

Hi, First of all, thanks @radshag for your precious contribution.

I've successfuly implemented your plugin in my application but I've noticed a strange behaviour. When using the startMonitoringSignificantLocationChanges function attached to the onDeviceReady event, the function returns "failed" if the app has been started right at the end of the installation process.

Then, if the app is closed and then started from the app menu, everything works fine.

— Reply to this email directly or view it on GitHub.

radshag commented 11 years ago

Is this on android or ios?

Sent from my iPhone

On 13 במרץ 2013, at 11:57, andreground notifications@github.com wrote:

Hi, First of all, thanks @radshag for your precious contribution.

I've successfuly implemented your plugin in my application but I've noticed a strange behaviour. When using the startMonitoringSignificantLocationChanges function attached to the onDeviceReady event, the function returns "failed" if the app has been started right at the end of the installation process.

Then, if the app is closed and then started from the app menu, everything works fine.

— Reply to this email directly or view it on GitHub.

andreground commented 11 years ago

Android :)

radshag commented 11 years ago

@edewit takes the credit for this one ;)

@edewit do you have any info to add to solve this issue?

andreground commented 11 years ago

Device version: 2.3.4

Fails also using the sample app and occasionally if you kill the process and restart the app.

edewit commented 11 years ago

Can you try it with the latest version I've fixed a couple of things and it gives back a better error that will help me to fix it.

andreground commented 11 years ago

@edewit Sure! But...what do you mean by latest? I cannot find any new commit dated today.

Thanks!

andreground commented 11 years ago

Btw, even addRegion fails if triggered in the same way. After restarting the app it works too.

edewit commented 11 years ago

Didn't know that you where on the latest, committed things yesterday. What is the error that you get?

andreground commented 11 years ago

"Failed to monitor location change"

edewit commented 11 years ago

That better error logging turned out to work great... you are trying this with the example app right?

andreground commented 11 years ago

Bot with mine and with the example.

Here comes the debug log:

03-13 12:25:40.378: D/AndroidRuntime(11631): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<< 03-13 12:25:40.378: D/AndroidRuntime(11631): CheckJNI is ON 03-13 12:25:40.448: D/dalvikvm(11631): Trying to load lib libjavacore.so 0x0 03-13 12:25:40.458: D/dalvikvm(11631): Added shared lib libjavacore.so 0x0 03-13 12:25:40.488: D/dalvikvm(11631): Trying to load lib libnativehelper.so 0x0 03-13 12:25:40.488: D/dalvikvm(11631): Added shared lib libnativehelper.so 0x0 03-13 12:25:41.378: D/AndroidRuntime(11631): Calling main entry com.android.commands.pm.Pm 03-13 12:25:41.478: W/ActivityManager(276): No content provider found for permission revoke: file:///data/local/tmp/HelloMondo-debug.apk 03-13 12:25:41.789: W/ActivityManager(276): No content provider found for permission revoke: file:///data/local/tmp/HelloMondo-debug.apk 03-13 12:25:41.789: I/PackageManager(276): Copying native libraries to /data/app-lib/vmdl-717139877 03-13 12:25:42.268: I/PackageManager(276): Removing non-system package:com.bdueb.hellomondo 03-13 12:25:42.268: I/ActivityManager(276): Force stopping package com.bdueb.hellomondo appid=10050 user=-1 03-13 12:25:42.268: I/ActivityManager(276): Killing proc 11588:com.bdueb.hellomondo/u0a10050: force stop com.bdueb.hellomondo 03-13 12:25:42.438: I/PackageManager(276): Package com.bdueb.hellomondo codePath changed from /data/app/com.bdueb.hellomondo-2.apk to /data/app/com.bdueb.hellomondo-1.apk; Retaining data and using new 03-13 12:25:42.438: I/PackageManager(276): Running dexopt on: com.bdueb.hellomondo 03-13 12:25:44.198: D/dalvikvm(11642): DexOpt: load 269ms, verify+opt 1115ms, 1154388 bytes 03-13 12:25:44.238: I/ActivityManager(276): Force stopping package com.bdueb.hellomondo appid=10050 user=-1 03-13 12:25:44.238: W/PackageManager(276): Code path for pkg : com.bdueb.hellomondo changing from /data/app/com.bdueb.hellomondo-2.apk to /data/app/com.bdueb.hellomondo-1.apk 03-13 12:25:44.238: W/PackageManager(276): Resource path for pkg : com.bdueb.hellomondo changing from /data/app/com.bdueb.hellomondo-2.apk to /data/app/com.bdueb.hellomondo-1.apk 03-13 12:25:44.358: D/PackageManager(276): New package installed in /data/app/com.bdueb.hellomondo-1.apk 03-13 12:25:44.368: W/PackageManager(276): Unknown permission android.permission.RECORD_VIDEO in package com.ogonium.GeofencingAndroidSample 03-13 12:25:44.368: W/PackageManager(276): Unknown permission android.permission.ADD_SYSTEM_SERVICE in package com.android.phone 03-13 12:25:44.388: W/PackageManager(276): Unknown permission com.android.smspush.WAPPUSH_MANAGER_BIND in package com.android.phone 03-13 12:25:44.388: W/PackageManager(276): Unknown permission com.android.vending.billing.BILLING_ACCOUNT_SERVICE in package com.google.android.gsf.login 03-13 12:25:44.388: W/PackageManager(276): Unknown permission com.android.vending.billing.ADD_CREDIT_CARD in package com.google.android.gsf.login 03-13 12:25:44.388: W/PackageManager(276): Unknown permission com.android.vending.billing.IBillingAccountService.BIND2 in package com.google.android.gsf.login 03-13 12:25:44.388: W/PackageManager(276): Unknown permission com.android.vending.TOS_ACKED in package com.google.android.gsf.login 03-13 12:25:44.388: W/PackageManager(276): Unknown permission com.android.chrome.TOS_ACKED in package com.google.android.gsf.login 03-13 12:25:44.408: W/PackageManager(276): Not granting permission android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS to package com.android.browser (protectionLevel=2 flags=0x89be45) 03-13 12:25:44.408: W/PackageManager(276): Unknown permission android.permission.RECORD_VIDEO in package com.bdueb.helloworld 03-13 12:25:44.408: W/PackageManager(276): Not granting permission android.permission.BIND_APPWIDGET to package com.android.widgetpreview (protectionLevel=18 flags=0x8be44) 03-13 12:25:44.569: D/dalvikvm(276): GC_CONCURRENT freed 1382K, 25% free 8821K/11608K, paused 7ms+21ms, total 144ms 03-13 12:25:44.599: W/PackageManager(276): Unknown permission com.android.email.permission.READ_ATTACHMENT in package com.android.exchange 03-13 12:25:44.599: W/PackageManager(276): Unknown permission com.android.email.permission.ACCESS_PROVIDER in package com.android.exchange 03-13 12:25:44.599: W/PackageManager(276): Unknown permission com.google.android.gallery3d.permission.GALLERY_PROVIDER in package com.android.exchange 03-13 12:25:44.609: W/PackageManager(276): Unknown permission com.android.providers.im.permission.READ_ONLY in package com.google.android.apps.maps 03-13 12:25:44.619: W/PackageManager(276): Not granting permission android.permission.DEVICE_POWER to package com.android.deskclock (protectionLevel=2 flags=0x88be45) 03-13 12:25:44.629: W/PackageManager(276): Not granting permission android.permission.READ_DREAM_STATE to package com.google.android.gsf (protectionLevel=2 flags=0x883e45) 03-13 12:25:44.629: W/PackageManager(276): Unknown permission android.permission.RECORD_VIDEO in package com.bdueb.hellomondo 03-13 12:25:44.778: I/ActivityManager(276): Force stopping package com.bdueb.hellomondo appid=10050 user=0 03-13 12:25:44.898: D/dalvikvm(396): GC_EXPLICIT freed 951K, 59% free 7483K/18168K, paused 8ms+12ms, total 92ms 03-13 12:25:45.018: D/dalvikvm(5307): GC_EXPLICIT freed 158K, 12% free 2720K/3084K, paused 3ms+5ms, total 97ms 03-13 12:25:45.128: I/InputReader(276): Reconfiguring input devices. changes=0x00000010 03-13 12:25:45.208: W/ContextImpl(6189): Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1352 android.content.ContextWrapper.startService:450 android.content.ContextWrapper.startService:450 com.android.keychain.KeyChainBroadcastReceiver.onReceive:12 android.app.ActivityThread.handleReceiver:2376 03-13 12:25:45.479: I/InputReader(276): Reconfiguring input devices. changes=0x00000010 03-13 12:25:46.818: W/InputMethodManagerService(276): Found no subtypes in a system IME: com.android.inputmethod.pinyin 03-13 12:25:47.469: W/RecognitionManagerService(276): no available voice recognition services found for user 0 03-13 12:25:47.618: D/dalvikvm(276): GC_EXPLICIT freed 866K, 25% free 8737K/11608K, paused 81ms+213ms, total 968ms 03-13 12:25:47.658: D/AndroidRuntime(11631): Shutting down VM 03-13 12:25:47.688: D/dalvikvm(11631): GC_CONCURRENT freed 95K, 18% free 467K/564K, paused 0ms+1ms, total 21ms 03-13 12:25:47.688: D/jdwp(11631): Got wake-up signal, bailing out of select 03-13 12:25:47.688: D/dalvikvm(11631): Debugger has detached; object registry had 1 entries 03-13 12:25:48.998: D/AndroidRuntime(11651): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<< 03-13 12:25:48.998: D/AndroidRuntime(11651): CheckJNI is ON 03-13 12:25:49.068: D/dalvikvm(11651): Trying to load lib libjavacore.so 0x0 03-13 12:25:49.088: D/dalvikvm(11651): Added shared lib libjavacore.so 0x0 03-13 12:25:49.148: D/dalvikvm(11651): Trying to load lib libnativehelper.so 0x0 03-13 12:25:49.148: D/dalvikvm(11651): Added shared lib libnativehelper.so 0x0 03-13 12:25:50.069: D/AndroidRuntime(11651): Calling main entry com.android.commands.am.Am 03-13 12:25:50.069: D/dalvikvm(11651): Note: class Landroid/app/ActivityManagerNative; has 157 unimplemented (abstract) methods 03-13 12:25:50.119: I/ActivityManager(276): START u0 {flg=0x10000000 cmp=com.bdueb.hellomondo/.HelloMondo} from pid 11651 03-13 12:25:50.169: W/WindowManager(276): Failure taking screenshot for (328x583) to layer 21040 03-13 12:25:50.328: D/AndroidRuntime(11651): Shutting down VM 03-13 12:25:50.348: D/dalvikvm(11651): GC_CONCURRENT freed 95K, 17% free 500K/600K, paused 1ms+1ms, total 14ms 03-13 12:25:50.348: D/jdwp(11651): Got wake-up signal, bailing out of select 03-13 12:25:50.348: D/dalvikvm(11651): Debugger has detached; object registry had 1 entries 03-13 12:25:50.368: D/dalvikvm(11662): Not late-enabling CheckJNI (already on) 03-13 12:25:50.398: I/ActivityManager(276): Start proc com.bdueb.hellomondo for activity com.bdueb.hellomondo/.HelloMondo: pid=11662 uid=10050 gids={50050, 1006, 3003, 1015, 1028} 03-13 12:25:50.478: E/SurfaceFlinger(36): ro.sf.lcd_density must be defined as a build property 03-13 12:25:50.498: D/dalvikvm(37): GC_EXPLICIT freed 40K, 7% free 2403K/2560K, paused 5ms+15ms, total 113ms 03-13 12:25:50.638: D/dalvikvm(37): GC_EXPLICIT freed <1K, 7% free 2404K/2560K, paused 4ms+26ms, total 142ms 03-13 12:25:50.738: D/dalvikvm(37): GC_EXPLICIT freed <1K, 7% free 2404K/2560K, paused 3ms+5ms, total 99ms 03-13 12:25:51.039: E/Trace(11662): error opening trace file: No such file or directory (2) 03-13 12:25:51.638: I/CordovaLog(11662): Changing log level to DEBUG(3) 03-13 12:25:51.668: I/CordovaLog(11662): Found preference for useBrowserHistory=true 03-13 12:25:51.678: D/CordovaLog(11662): Found preference for useBrowserHistory=true 03-13 12:25:51.678: I/CordovaLog(11662): Found preference for exit-on-suspend=false 03-13 12:25:51.728: D/CordovaLog(11662): Found preference for exit-on-suspend=false 03-13 12:25:51.738: D/DroidGap(11662): DroidGap.onCreate() 03-13 12:25:51.919: D/dalvikvm(11662): GC_FOR_ALLOC freed 73K, 8% free 2542K/2736K, paused 32ms, total 34ms 03-13 12:25:51.928: I/dalvikvm-heap(11662): Grow heap (frag case) to 3.669MB for 1127536-byte allocation 03-13 12:25:51.999: D/dalvikvm(11662): GC_FOR_ALLOC freed 1K, 6% free 3642K/3840K, paused 66ms, total 66ms 03-13 12:25:52.069: D/dalvikvm(11662): GC_CONCURRENT freed <1K, 5% free 3651K/3840K, paused 4ms+18ms, total 71ms 03-13 12:25:52.258: D/JsMessageQueue(11662): Set native->JS mode to 2 03-13 12:25:52.288: D/DroidGap(11662): DroidGap.init() 03-13 12:25:52.318: D/CordovaWebView(11662): >>> loadUrl(file:///android_asset/www/index.html) 03-13 12:25:52.318: D/PluginManager(11662): init() 03-13 12:25:52.358: D/CordovaWebView(11662): >>> loadUrlNow() 03-13 12:25:52.358: D/DroidGap(11662): Resuming the App 03-13 12:25:52.428: D/SoftKeyboardDetect(11662): Ignore this event 03-13 12:25:52.518: E/SurfaceFlinger(36): ro.sf.lcd_density must be defined as a build property 03-13 12:25:52.608: D/gralloc_goldfish(11662): Emulator without GPU emulation detected. 03-13 12:25:52.608: I/Choreographer(396): Skipped 118 frames! The application may be doing too much work on its main thread. 03-13 12:25:52.909: I/ActivityManager(276): Displayed com.bdueb.hellomondo/.HelloMondo: +2s592ms 03-13 12:25:53.098: D/DroidGap(11662): onMessage(onPageStarted,file:///android_asset/www/index.html) 03-13 12:25:53.149: D/SoftKeyboardDetect(11662): Ignore this event 03-13 12:25:53.989: D/dalvikvm(11662): GC_CONCURRENT freed 86K, 6% free 4027K/4260K, paused 6ms+3ms, total 74ms 03-13 12:25:54.188: E/SurfaceFlinger(36): ro.sf.lcd_density must be defined as a build property 03-13 12:25:54.188: E/SurfaceFlinger(36): ro.sf.lcd_density must be defined as a build property 03-13 12:25:54.698: D/dalvikvm(11662): GC_CONCURRENT freed 299K, 10% free 4187K/4628K, paused 10ms+23ms, total 80ms 03-13 12:25:54.928: E/SurfaceFlinger(36): ro.sf.lcd_density must be defined as a build property 03-13 12:25:56.858: D/dalvikvm(11251): GC_CONCURRENT freed 399K, 24% free 3900K/5080K, paused 6ms+4ms, total 46ms 03-13 12:25:57.898: W/InputMethodManagerService(276): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@4104f680 attribute=null, token = android.os.BinderProxy@40cd7120 03-13 12:26:04.928: E/SurfaceFlinger(36): ro.sf.lcd_density must be defined as a build property 03-13 12:26:04.958: E/SurfaceFlinger(36): ro.sf.lcd_density must be defined as a build property 03-13 12:26:05.618: D/Cordova(11662): onPageFinished(file:///android_asset/www/index.html) 03-13 12:26:05.618: D/Cordova(11662): Trying to fire onNativeReady 03-13 12:26:05.628: D/DroidGap(11662): onMessage(onNativeReady,null) 03-13 12:26:05.628: D/DroidGap(11662): onMessage(onPageFinished,file:///android_asset/www/index.html) 03-13 12:26:05.718: W/chromium(11662): external/chromium/net/disk_cache/backend_impl.cc:1835: [0313/122605:WARNING:backend_impl.cc(1835)] Destroying invalid entry. 03-13 12:26:06.528: D/CordovaNetworkManager(11662): Connection Type: 3g 03-13 12:26:06.528: D/DroidGap(11662): onMessage(networkconnection,3g) 03-13 12:26:06.538: D/CordovaNetworkManager(11662): Connection Type: 3g 03-13 12:26:06.568: D/DroidGap(11662): onMessage(spinner,stop) 03-13 12:26:06.758: D/TilesManager(11662): Starting TG #0, 0x2a349040 03-13 12:26:06.989: I/Deprecation Notice(11662): Replace ctx.getContext() with cordova.getContext() 03-13 12:26:07.009: D/GCMRegistrar(11662): resetting backoff for com.bdueb.hellomondo 03-13 12:26:07.338: D/DGGeofencingService(11662): onLocationChanged with location 03-13 12:26:07.338: D/DGGeofencingService(11662): Lat: 45.495532 03-13 12:26:07.338: D/DGGeofencingService(11662): Long: -91272541.000000 03-13 12:26:07.338: D/DGGeofencingService(11662): Alt: 0.000000 03-13 12:26:07.338: D/DGGeofencingService(11662): Bearing: 0.000000 03-13 12:26:07.809: E/SurfaceFlinger(36): ro.sf.lcd_density must be defined as a build property 03-13 12:26:07.819: D/DroidGap(11662): onMessage(spinner,stop) 03-13 12:26:09.749: W/InputMethodManagerService(276): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@4100e610 attribute=null, token = android.os.BinderProxy@40cd7120 03-13 12:26:12.819: D/GCMBaseIntentService(11662): handleRegistration: registrationId = APA91bGJgnsau5bj2XkCgUvgcZ0cTxresXA1xZ-4VMl2SZY7k5VHHbfVNHgnNfL6GYVx1ppj2UOqFSsplf3_B12qAzrQ-7DIDE6JYtF5f3Hmso4cMUmtoNp1BGEAbRfe2AdnukkbPnTfza3keRgqwQ5eycHF0lJwxA, error = null, unregistered = null 03-13 12:26:12.819: D/GCMRegistrar(11662): resetting backoff for com.bdueb.hellomondo

edewit commented 11 years ago

Ahh I see the demo comes with it's own version of the plugin... will be good when we can change this a bit, anyway created a push request that will update the android demo with the latest plugin

andreground commented 11 years ago

Got the point @edewit . Btw, had to correct some references and rename file names from DGGeofencing to DGGeoFencing :)

Thanks for the precious help!