Remove proximity alerts when uninstalling app - android

I have a problem with proximity alerts on Android.
Here's what I'm doing in my app
Fetch list of locations from server.
Add proximity alerts of these locations (now GPS icon shows in status bar).
When user enters the area launch my app activity.
Problem is that, when I uninstall my app with proximity alerts added it still shows GPS icon in status bar. User can turn off all proximity alerts in app but it doesn't solve my problem. I also now that it's impossible to do anything during uninstall process. Any ideas?
//EDIT:
Only way to get rid of GPS icon after app uninstall is to restart the device.

Report bug to Android developers. LocationManager should handle such use case (this case is easy to forget and apparently Android developers forgot about that).
As a workaround you can try to create a service which will exist as long as you need proximity alert. I'm hoping that service is gracefully closed on removal and not just killed. In such case you will remove proximity alert. You have to try it to be sure that this is good solution.

Related

getting infrequent location update without notification?

I want to get location update few times an hour from android device.
I think the following paragraph implies I can achieve what I want..
https://developer.android.com/about/versions/oreo/background-location-limits#tuning-behavior
Consider whether your app's use cases for running in the background
cannot succeed at all if your app receives infrequent location
updates. If this is the case, you can retrieve location updates more
frequently by performing one of the following actions:
Bring your app to the foreground
I understand it as app can receive infrequent location updates without bring your app to the foreground (is my english bad ? :()
Google Map does track where you go without notifying you that "it is tracking you" when the map app is in the background , even when it's killed.
How can I achieve that ?
I've looked at
https://github.com/mauron85/react-native-background-geolocation.
https://github.com/transistorsoft/react-native-background-geolocation
and there seems to no way to not display the notification.
How can I achieve what google Map does?
tracking device location without showing the notification?
Is google having an unfair advantage at this?

Recent changes in Location manager behavior?

I develop a running app that use GPS location through LocationManager to deliver a Turn by Turn navigation experience.
Yesterday, ï discovered that I do not receive any location updates when app in background (phone locked) anymore.
This could not be a code regression because none of my previous git commit work neither. And I know I could receive location updates during last tests few weeks ago.
Then I tested other GPS-based app like Waze and others, but same result : none of them could update my position when going in background (except for GMaps), meaning I have no navigation instruction if my phone is locked. I have tested with other phones Samsung S8, S9, and Asus ... no changes.
Does anybody know if there was a recent changes in LocationManager behavior?
Thank you.
I found a good workaround.
In order to receive GPS location while in background with Android 8.0, we need to create a foreground service that ask for location update and pass it to your activity.
Here is an example of that.

Cordova doesn't track gps state if it's on/off

I'm using the navigator.geolocation objet to watch the position of the gps. I've found a bug, here are the steps:
1) Gps if off.
2) App start.
3) Gps is activated from the notification panel.
4) App doesn't notice any change.
At this point, only a window.location.reload() makes the app recognize that the gps is active.
If the App is started with the gps on, switching it on and off while the app is running cause no issue, the app recognize its state.
Do you know any way to solve this problem?
May be this will help you
https://github.com/mablack/cordova-diagnostic-plugin
I think the Geolocation API does not give you an error if the GPS is on/off, just a timeout error if it is not able to get a lock in the time limit you specify, but I tested it a while ago and I might be mistaking.

turn on/off gps without shownig icon in status bar

In my android application, I succeed with turning on/off gps dynamically whenever required. But I am struggling with hide the gps icon in status bar when turn on gps. How can I do it?
NOTE: I also succeed with hiding whole status bar by making full screen. But I want to hide only gps icon.
You cannot do this. The status bar icon is controlled by the system and it will not allow third party apps to hide it when GPS is on. This is for security reasons as well. Any rogue app could secretly perform malicious operations using the user's location without the user knowing about it if s/he has no indication that GPS is active.
Why would you hide GPS icon?
I think this is a bad idea, since users want to know whether their GPS is active or not.
This would allows applications to snoop users position without them being aware of that fact, which is NOT a good practise. And this is why your app requires a permission to access phone location.
if you have sdk source file, it's easy:
modify NotificationManagerService.java
in methed enqueueNotificationInternal, add a flag (db file or create a file in /data/) ,when the gps application try to send notification, block it(refer to the packagename).
but if you do not have one ....
sorry ,i don't know.
I too got same problem, means when I am asking for gps to give location updates then it will show that gps icon, so if you remove those updates calling like locationmanager.removeupdates(locationListener), then it will remove that gps icon in status bar

Android: Proximity Alert

I have followed this tutorial about how to use the proximity alert and how to register it.
It all works but when I close the app (with the back button, not the home-button) then the proximity alert does not work anymore. Does anyone know how to set it so that it runs in the background?
Thanks in advance!
It seems that you can not get location updates when your application is not running. Receiving location updates in the background is not a good idea since it drains battery power and the user might not be aware that the location is being tracked since the normal behavior for pressing the back button on the application is for it to close all services. If I want my application to continue running in the background, I as a user would press the home button.
Look at the model used by the "My Tracks" application.
Also see the documentation from Android on locations and usage models:
http://developer.android.com/guide/topics/location/obtaining-user-location.html
If you have informed yourself about the reasons not to have the application do this in the background but still want to run this in the background, look into Services
http://developer.android.com/reference/android/app/Service.html
They can run in the background and provide your application with data when asked.
Fundamental part of Android... Services.
http://developer.android.com/guide/topics/fundamentals/services.html
You should get it if you register for it, but keep in mind that proximity alert may not be immediate if your screen is off. If your screen is off, then location is probed for every 4 minutes as stated in the documentation.

Categories

Resources