简体   繁体   中英

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.

我也有同样的问题,意味着当我要求gps提供位置更新然后它会显示gps图标,所以如果你删除那些调用像locationmanager.removeupdates(locationListener)的更新,那么它将删除状态栏中的那个gps图标

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM