Reputation:
I need to hide the GPS icon from the status bar when my service disabled.
In my application I have two menu options, when I press the "enable" then the gps icon has to display on status bar and when I press the "disable" then the gps icon should not display on the status bar.
Upvotes: 1
Views: 8813
Reputation: 5378
If you are requesting for GPS updates through the LocationManager
, you can use this function to remove the updates (disable GPS):
locationManager.removeUpdates(this);
Upvotes: 2
Reputation: 1856
To hide the GPS icon when service is stop you need to remove registration for location updates of the current activity.
You can do this by calling the removeUpdates(PendingIntent intent)
on location manager.
removeUpdates(PendingIntent intent)
Removes any current registration for location updates of the current activity with the given PendingIntent.
check out this Link
Upvotes: 1
Reputation: 6197
Simple. When you want the icon, enable GPS, and when you don't want it, disable GPS.
Upvotes: 0
Reputation: 17247
Simply you gonna have to disable the GPS device. When you disable GPS, icon will dissapear from the system tray.
Check this question for the answer.
Upvotes: 0