Git Product home page Git Product logo

Comments (23)

vincenzoiacovone avatar vincenzoiacovone commented on July 16, 2024

with locationProvider = 1 (activity) GPS works normally, but seems that interval number specified is not considered.

The problem of GPS crashing seems affect only locationProvider 0 (distance filter)

from react-native-background-geolocation.

BigPun86 avatar BigPun86 commented on July 16, 2024

+1

from react-native-background-geolocation.

mauron85 avatar mauron85 commented on July 16, 2024

Can you post log of crash from adb logcat?

from react-native-background-geolocation.

mauron85 avatar mauron85 commented on July 16, 2024

Ok, I've probably found problem. Just for confirmation. Does crash occur only after reload or it crashes also without reload?
https://facebook.github.io/react-native/docs/debugging.html#reloading-javascript

from react-native-background-geolocation.

mauron85 avatar mauron85 commented on July 16, 2024

Fixed crashed when app was reloaded from dev menu in "0.2.0-alpha.3". Reopen if necessary.

from react-native-background-geolocation.

DanDance avatar DanDance commented on July 16, 2024

Have almost same problem.
App crashes after success callback of .start method.

  • Plugin version: 1.0.8
  • Platform: Android
  • OS version: 4.4.2
  • Device manufacturer and model: Alcatel One Touch P310X
  • React Native version: 0.28

Plugin configuration options:
BackgroundGeolocation.configure({
desiredAccuracy: 100,
stationaryRadius: 50,
distanceFilter: 50,
debug: false,
interval: 15000,
stopOnStillActivity: false,
stopOnTerminate: false,
maxLocations: 100
})

Expected Behavior

Plugin starts tracking device location, calls on('location') callback.

Actual Behavior

I can see console.log in .start success callback, .on('location') never called, app crashes.
adb logcat | grep BackgroundGeolocation shows

I/com.marianhello.react.BackgroundGeolocationModule(28598): App will be resumed
I/com.marianhello.react.BackgroundGeolocationModule(28598): App will be paused
I/com.marianhello.react.BackgroundGeolocationModule(28598): initializing plugin
I/com.marianhello.react.BackgroundGeolocationModule(28598): App will be resumed
I/com.marianhello.react.BackgroundGeolocationModule(28598): Requesting permissions from user
W/System.err(28598): at     com.marianhello.react.BackgroundGeolocationModule$1.onServiceConnected(BackgroundGeolocationModule.java:203)    
E/AndroidRuntime(28598):  at com.marianhello.react.BackgroundGeolocationModule$1.onServiceConnected(BackgroundGeolocationModule.java:203)

Steps to Reproduce

Configure plugin in componentWillMount
Handle .on('location')
.start with callback

from react-native-background-geolocation.

mauron85 avatar mauron85 commented on July 16, 2024

Can you post full log? Few more lines will reveal full stacktrace. PS. Version 1.08 does not exist, which version are you using? PS2: Also upgrade to RN 0.33. Some issues related to this are fixed in 0.33

from react-native-background-geolocation.

DanDance avatar DanDance commented on July 16, 2024

I am sorry, version is 0.2.0-alpha.4.
I am afraid that upgrade to 0.33 will cause troubles with different plugins.

Full adb logcat is here:
http://pastebin.com/yEnNX0Se

from react-native-background-geolocation.

DanDance avatar DanDance commented on July 16, 2024

Here is adb logcat | grep com.marianhello. May be it could be useful.

D/ActivityThread(13398): SVC-Creating service:     CreateServiceData{token=android.os.BinderProxy@41f20440 className=com.marianhello.bgloc.LocationService packageName=com.driverapp intent=null}
D/ActivityThread(13398): SVC-CREATE_SERVICE handled : 0 / CreateServiceData{token=android.os.BinderProxy@41f20440 className=com.marianhello.bgloc.LocationService packageName=com.driverapp intent=null}
D/ActivityThread(13398): SVC-SERVICE_ARGS handled : 0 / ServiceArgsData{token=android.os.BinderProxy@41f20440 startId=5 args=Intent { flg=0x4 cmp=com.driverapp/com.marianhello.bgloc.LocationService (has extras) }}
D/ActivityThread(13398): SVC-BIND_SERVICE handled : 0 / BindServiceData{token=android.os.BinderProxy@41f20440 intent=Intent { cmp=com.driverapp/com.marianhello.bgloc.LocationService (has extras) }}
E/AndroidRuntime(13398):    at com.marianhello.react.BackgroundGeolocationModule$1.onServiceConnected(BackgroundGeolocationModule.java:203)

/* Here I launch application*/

I/com.marianhello.react.BackgroundGeolocationModule(13569): initializing plugin
I/com.marianhello.react.BackgroundGeolocationModule(13569): App will be resumed
D/com.marianhello.bgloc.data.sqlite.SQLiteConfigurationDAO(13569): Configuration persisted with rowId = 1
I/com.marianhello.react.BackgroundGeolocationModule(13569): Requesting permissions from user
D/ActivityThread(13569): SVC-Creating service: CreateServiceData{token=android.os.BinderProxy@41ef9d50 className=com.marianhello.bgloc.LocationService packageName=com.driverapp intent=null}
I/com.marianhello.bgloc.LocationService(13569): Creating LocationService
D/ActivityThread(13569): SVC-CREATE_SERVICE handled : 0 / CreateServiceData{token=android.os.BinderProxy@41ef9d50 className=com.marianhello.bgloc.LocationService packageName=com.driverapp intent=null}
D/ActivityThread(13569): SVC-Calling onStartCommand: com.marianhello.bgloc.LocationService@41e86cc8, flags=0, startId=6
I/com.marianhello.bgloc.LocationService(13569): Received start startId: 6 intent: Intent { flg=0x4 cmp=com.driverapp/com.marianhello.bgloc.LocationService (has extras) }
I/com.marianhello.bgloc.LocationService(13569): Network condition changed hasConnectivity: true
D/com.marianhello.bgloc.LocationService(13569): Will start service with: Config[distanceFilter=50 stationaryRadius=50.0 desiredAccuracy=100 interval=15000 fastestInterval=120000 activitiesInterval=10000 isDebugging=false stopOnTerminate=false stopOnStillActivity=false startOnBoot=false startForeground=true locationProvider=0 nTitle=Background tracking nText=ENABLED nIconLarge=null nIconSmall=null nIconColor=null url=null syncUrl=null syncThreshold=100 httpHeaders={} maxLocations=10000]
D/ActivityThread(13569): SVC-SERVICE_ARGS handled : 0 / ServiceArgsData{token=android.os.BinderProxy@41ef9d50 startId=6 args=Intent { flg=0x4 cmp=com.driverapp/com.marianhello.bgloc.LocationService (has extras) }}
D/ActivityThread(13569): SVC-BIND_SERVICE handled : 0 / BindServiceData{token=android.os.BinderProxy@41ef9d50 intent=Intent { cmp=com.driverapp/com.marianhello.bgloc.LocationService (has extras) }}
W/System.err(13569):    at com.marianhello.react.BackgroundGeolocationModule$1.onServiceConnected(BackgroundGeolocationModule.java:203)
E/AndroidRuntime(13569):    at com.marianhello.react.BackgroundGeolocationModule$1.onServiceConnected(BackgroundGeolocationModule.java:203)

from react-native-background-geolocation.

mauron85 avatar mauron85 commented on July 16, 2024

Pastebin logs are useless, there is no crash there. And second one also. I need to 'see' after lines:

W/System.err(13569):    at com.marianhello.react.BackgroundGeolocationModule$1.onServiceConnected(BackgroundGeolocationModule.java:203)
E/AndroidRuntime(13569):    at com.marianhello.react.BackgroundGeolocationModule$1.onServiceConnected(BackgroundGeolocationModule.java:203)

Do not grep, because if filters out the most import part.

from react-native-background-geolocation.

DanDance avatar DanDance commented on July 16, 2024

http://pastebin.com/EpEvQuZq

from react-native-background-geolocation.

DanDance avatar DanDance commented on July 16, 2024

Upgrading React Native to 0.33.0 didn't solve the problem

from react-native-background-geolocation.

mauron85 avatar mauron85 commented on July 16, 2024

Ok last log was quite helpful. There is exception: java.lang.NoSuchFieldError: android.os.Message.sendingUid thrown in BackgroundGeolocationModule.java:203 which was added to API level 21 (Android 5.0) and you're on 4.4.2. Will try to find workaround for 4.4

from react-native-background-geolocation.

mauron85 avatar mauron85 commented on July 16, 2024

Please try installing from git branch issue10.

npm i https://github.com/mauron85/react-native-background-geolocation#issue10

from react-native-background-geolocation.

DanDance avatar DanDance commented on July 16, 2024

installed from https://github.com/mauron85/react-native-background-geolocation#issue10

Now it's not crashing. But after launching application .on('location') handler works only in the beginning. Sometimes debug says Stationary exit in 23.00349.

I want plugin to check my position every 15 sec. Am I doing something wrong?
Here is the code.

logError = (msg) => {
  console.log(`[ERROR] getLocations: ${msg}`);
  console.log(error)
}

BackgroundGeolocation.on('location', (location) => {
  console.log('[DEBUG] BackgroundGeolocation location', location);
});

BackgroundGeolocation.configure({
  desiredAccuracy: 10,
  stationaryRadius: 25,
  distanceFilter: 25,
  debug: true,
  interval: 15000,
  stopOnStillActivity: false,
  stopOnTerminate: false,
  maxLocations: 100
})
BackgroundGeolocation.start(() => {
    console.log('[DEBUG] BackgroundGeolocation started successfully');
  },
  (error) => {
    console.log('[ERROR] Start failed: ' + error.message);
  });

from react-native-background-geolocation.

mauron85 avatar mauron85 commented on July 16, 2024

That's how it works. It is using distance filter to save battery.. https://github.com/mauron85/cordova-plugin-background-geolocation/blob/master/ANDROID_DISTANCE_FILTER_PROVIDER.md

There is also another ANDROID_ACTIVITY_PROVIDER, which doesn't have distance filter. You can choose between those two.

https://github.com/mauron85/cordova-plugin-background-geolocation/blob/master/PROVIDERS.md

PS: need to copy these docs from cordova repo.

from react-native-background-geolocation.

vincenzoiacovone avatar vincenzoiacovone commented on July 16, 2024

When i put the application in background and send location update (both emulator and real device), i've got this errors:

09-15 13:58:55.377 12111-12111/com.speedalert I/com.marianhello.react.BackgroundGeolocationModule: App will be paused 09-15 13:58:56.444 12111-12111/com.speedalert I/com.marianhello.react.BackgroundGeolocationModule: Destroying plugin 09-15 13:58:56.490 12111-12111/com.speedalert W/ViewPager: Requested offscreen page limit 0 too small; defaulting to 1 09-15 13:58:56.491 12111-12111/com.speedalert E/ActivityThread: Activity com.speedalert.MainActivity has leaked ServiceConnection com.marianhello.react.BackgroundGeolocationModule$1@2442b00f that was originally bound here android.app.ServiceConnectionLeaked: Activity com.speedalert.MainActivity has leaked ServiceConnection com.marianhello.react.BackgroundGeolocationModule$1@2442b00f that was originally bound here at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:1077) at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:971) at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1774) at android.app.ContextImpl.bindService(ContextImpl.java:1757) at android.content.ContextWrapper.bindService(ContextWrapper.java:539) at com.marianhello.react.BackgroundGeolocationModule.doBindService(BackgroundGeolocationModule.java:477) at com.marianhello.react.BackgroundGeolocationModule.startAndBindBackgroundService(BackgroundGeolocationModule.java:442) at com.marianhello.react.BackgroundGeolocationModule.start(BackgroundGeolocationModule.java:277) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:319) at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:139) at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31) at android.os.Looper.loop(Looper.java:135) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196) at java.lang.Thread.run(Thread.java:818) 09-15 13:58:56.506 12111-12111/com.speedalert W/unknown:React: Tried to enqueue runnable on already finished thread: 'js... dropping Runnable. 09-15 13:58:56.508 12111-12111/com.speedalert W/MessageQueue: Handler (com.facebook.react.bridge.queue.MessageQueueThreadHandler) {1d720b54} sending message to a Handler on a dead thread java.lang.IllegalStateException: Handler (com.facebook.react.bridge.queue.MessageQueueThreadHandler) {1d720b54} sending message to a Handler on a dead thread at android.os.MessageQueue.enqueueMessage(MessageQueue.java:325) at android.os.Handler.enqueueMessage(Handler.java:631) at android.os.Handler.sendMessageAtTime(Handler.java:600) at android.os.Handler.sendMessageDelayed(Handler.java:570) at android.os.Handler.post(Handler.java:326) at com.facebook.react.bridge.queue.MessageQueueThreadImpl.runOnQueue(MessageQueueThreadImpl.java:61) at com.facebook.react.bridge.ReactContext.runOnJSQueueThread(ReactContext.java:247) at com.facebook.react.uimanager.events.EventDispatcher$ScheduleDispatchFrameCallback.doFrame(EventDispatcher.java:258) at com.facebook.react.uimanager.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:131) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:765) at android.view.Choreographer.doCallbacks(Choreographer.java:580) at android.view.Choreographer.doFrame(Choreographer.java:549) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

from react-native-background-geolocation.

mauron85 avatar mauron85 commented on July 16, 2024

@vincenzoiacovone are you using RN 0.33?

from react-native-background-geolocation.

vincenzoiacovone avatar vincenzoiacovone commented on July 16, 2024

I put the app in background using back button.

I use 0.32
Should i have to update the package?

from react-native-background-geolocation.

mauron85 avatar mauron85 commented on July 16, 2024

yes, it should be fixed with 0.33

from react-native-background-geolocation.

DanDance avatar DanDance commented on July 16, 2024

Hi again. On android 4.4.2 .watchLocationMode fail callback runs with Not implemented yet. Is there an opportunity to catch switch device gps to off?

from react-native-background-geolocation.

kholiavko-roman avatar kholiavko-roman commented on July 16, 2024

@DanDance , did you found the solution ?

from react-native-background-geolocation.

DanDance avatar DanDance commented on July 16, 2024

@kholiavko-roman with .watchLocationMode issue? Nope...

from react-native-background-geolocation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.