safetysystemtechnology / location-tracker-background Goto Github PK
View Code? Open in Web Editor NEWPeriodically tracking user's location in the background
Periodically tracking user's location in the background
Hi !
I'm having trouble with the AndroidManifest.xml file which is present in the library.
It seems to have it's own label, and so, I can't set mine in my app's manifest.
I've got this error when building :
`Error:Execution failed for task ':app:processDevDebugManifest'.
Manifest merger failed : Attribute application@label value=(Urbee) from AndroidManifest.xml:35:9-30
is also present at [com.github.safetysystemtechnology:location-tracker-background:v1.2] AndroidManifest.xml:16:9-41 value=(@string/app_name).
Suggestion: add 'tools:replace="android:label"' to element at AndroidManifest.xml:32:5-109:19 to override.`
How do i get the current location in a service ?
You application work grate but it did not work when app close. but I need user address every 30 second and update at online database. when app close by background service.
i have given permission but it gives error like.
":onPermissionDiened" in
@OverRide
public void onPermissionDiened() {
Log.d("callback", ":onPermissionDiened");
locationTracker.stopLocationService(getBaseContext());
}
W/System.err: java.lang.IllegalArgumentException: Receiver not registered: br.com.safety.locationlistenerhelper.core.CurrentLocationReceiver@d4a77b2
at android.app.LoadedApk.forgetReceiverDispatcher(LoadedApk.java:1011)
at android.app.ContextImpl.unregisterReceiver(ContextImpl.java:1368)
at android.content.ContextWrapper.unregisterReceiver(ContextWrapper.java:618)
at br.com.safety.locationlistenerhelper.core.LocationTracker.stopLocationService(LocationTracker.java:109)
at com.iamstudio.mensajeria.activities.DeliveryProcessActivity$onStart$1.onCurrentLocation(DeliveryProcessActivity.kt:92)
at br.com.safety.locationlistenerhelper.core.CurrentLocationReceiver.onReceive(CurrentLocationReceiver.java:28)
at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:1128)
at android.os.Handler.handleCallback(Handler.java:754)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6342)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)
This is working great bellow Android 8.0 but on or above 8.0 it is not receiving any Broadcast.
I think it might be issue of Background Execution Limits in Android Oreo.
https://developer.android.com/about/versions/oreo/background.html#broadcasts
Logs:
I/LocationService: Connected to GoogleApiClient
D/Info:: send broadcast location dataLocation
D/Info:: send broadcast location dataLocation
D/Info:: send broadcast location dataLocation
your code works perfect but facing a issue when am using it multiple times. I have started a never ending(didn't stop it) service to update current location to server with interval of 5 minutes which is working perfectly.
I have used this service with different broadcast receiver with interval of 30 seconds for specific time. But this doesn't start always. sometimes it start as it should but sometimes it doesn't start at all. But the first broadcast receiver always works perfectly.
What should I do actually when i want to know my location multiple times with different different intervals?
The example only works with an activity?
Normalmente a interface descreve o agente de uma ação ou uma função
Exemplo:
Listener -> Escutador -> o que escuta.
Observer -> Observador -> o que observa
Walker -> Andador -> que anda
Runnable -> Executável -> que pode ser executável
Comparable -> Comparável -> que pode ser comparado
Serializable....
...
I can't seem to correctly configure the gradle file per the README in my Android project. I keep getting the following Error: "Failed to resolve: com.github.safetysystemtechnology:location-tracker-background:v1.2". I tried adding the maven repository the project-level build.gradle file and the dependency to the Module:app-level build.gradle file. Same error. Apologies for the newbie question.
I/LocationService: Connected to GoogleApiClient
12-14 17:06:55.182 18446-18446/xyz.com.locationbackground D/Error:: Permission deined
12-14 17:06:55.189 18446-18446/xyz.com.locationbackground D/callback: :onPermissionDiened
[ 12-14 17:06:55.189 18446:18446 D/ ]
contextIsNotNull:
How i can stop the started location service?
This works fine for few minutes but after sometimes this only showing this message in logcat
D/Info:: send broadcast location data
i have tried using broadcast receiver which is registered with my mainactivity file but it not receives the message and also i tried wakelock but this method also not working.
I need to get location in background when app is minimized and not closed state and send location to server(i am running in android mobile version 7.1.2)
java.lang.RuntimeException: Unable to stop service br.com.safety.locationlistenerhelper.core.LocationService@2cbedd7: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.google.android.gms.common.api.GoogleApiClient.isConnected()' on a null object reference
at android.app.ActivityThread.handleStopService(ActivityThread.java:3741)
at android.app.ActivityThread.-wrap28(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1832)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:7002)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.google.android.gms.common.api.GoogleApiClient.isConnected()' on a null object reference
at br.com.safety.locationlistenerhelper.core.LocationService.stopLocationUpdates(LocationService.java:143)
at br.com.safety.locationlistenerhelper.core.LocationService.onDestroy(LocationService.java:150)
at android.app.ActivityThread.handleStopService(ActivityThread.java:3723)
at android.app.ActivityThread.-wrap28(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1832)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:7002)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
Usar contantes em interfaces é uma pratica ruim, ainda é mantido no java apenas por compatibilidade com o que foi implementado nas apis do Java 1.2.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.