transistorsoft / cordova-background-geolocation-lt

The most sophisticated background location-tracking & geofencing module with battery-conscious motion-detection intelligence for iOS and Android.
http://www.transistorsoft.com/shop/products/cordova-background-geolocation
Other
660 stars 276 forks source link

Plugin stops tracking after initialisation #1040

Closed 4ty711 closed 4 years ago

4ty711 commented 4 years ago

Your Environment

Expected Behavior

Motionchange and Location Events should be fired

Actual Behavior

After the first start(), one location and motionchange event ist fired, then it seems to stop tracking the location.

Debug logs

There are no errors or warnings...

christocracy commented 4 years ago

Sounds normal to me. Read the wiki “Philosophy of Operation” then go outside for a nice 1km walk.

christocracy commented 4 years ago

Btw, you don’t need Cordova-plugin-geolocation. This plugin has its own #getCurrentPosition method.

hboelling4711 commented 4 years ago

We have read the Wiki '' Philosophy of Operation ''. But it does not work anyway. We only get the first event when we are in a geofence region. Then we drove several times with the car and the running debugger. But we get neither the Exit Event and no further Motion Events. It just does not happen anymore. When we restart the app it is that we only ever get an event and nothing else. The creation of geofences works. We have already exchanged the GetCurrentlocation. Also without change.

christocracy commented 4 years ago

Huawei devices are the worst devices on earth for background operation. The OS is like a “nanny state”.

See http://dontkillmyapp.com.

One of my 11 test devices is a Huawei P20 Lite. I got it to work by following the directions on the link above.

hboelling4711 commented 4 years ago

Hello, thank you for your very fast answer. But so we can´t use your nice plug in for all mobile phones ? We have test on huawei tablet media pad 5 and on a ulefone node 7. thx for your help.

christocracy commented 4 years ago

You can use it for any phone, the user must follow the instructions at http://dontkillmyapp.com. As you can see there: “No Developer Solution”.

The fault is entirely with the device manufacturer violating the Android API and how the docs say things are supposed to work.

I regularly field test using the following devices:

hboelling4711 commented 4 years ago

We only get one motion event and then the service stops. If we start with driving the motion event don´t change to driving state. Now we have test with 4 mobile phones. thx for your help.

christocracy commented 4 years ago

If we start with driving the motion event don't change to driving state

Yes, that's what Huawei's device do until you modify the device's settings according to http://dontkillmyapp.com. The OS swallows events from the Motion API and refuses to pass them on to the app. You'll find that those events actually do come through later when you next unlock the device. Of course by then, those events are useless.

Follow the directions for you device in http://dontkillmyapp.com and you can make it work.

hboelling4711 commented 4 years ago

You think we should implement this Api in our app or we must change manually the settings in the settions section of android ?

christocracy commented 4 years ago

The directions at http://dontkillmyapp.com are very clear. The user much perform those actions in the settings of the device. Huawei devices are the worst. They break Android background services. Google is full of other developers having the same problem

hboelling4711 commented 4 years ago

Now we have tested and we have detect the following. If we starts Google Maps in the background and we see the android location icon on the top bar the app works fine and we get motion events !?

christocracy commented 4 years ago

My Huawei P20 works perfectly after following the directions in http://dontkillmyapp.com. I don't run any other apps and I don't even use the device. I simply place it in my backpack, along with my other 10 test-devices and go. The plugin does not require have some other app running for it to work.

hboelling4711 commented 4 years ago

Hello Chris, first of all thank you for your quick answers. We have implemented your note and removed the current location from the API. Also, we have changed the settings as described in http://dontkillmyapp.com. But only if Google Maps is open will we receive motion events. Can you please look again in our code if there is something wrong from your point of view? We have a big project and we want to start soon. thx

christocracy commented 4 years ago

There's nothing wrong with your code.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open.

stale[bot] commented 4 years ago

Closing this issue after a prolonged period of inactivity. Fell free to reopen this issue, if this still affecting you.