I am building an android app to track my device, is it possible to turn location services on via code?
I have searched for code to do so I have found some and on execution of code it gives some sort of security exceptions, and some threads here on stack overflow were saying that it is impossible to do so, If possible please provide code, if impossible why so?
is it possible to turn location services on via code?
Via Play Services' SettingsApi, yes. Otherwise, no, except perhaps on rooted devices or in a custom malware-friendly ROM.
Actually that opens up a dialog box, i don't want to involve user in it
Then that is not possible.
I have searched for code to do so i have found some and on execution of code it gives some sort of security exceptions
There have been various security flaws in Android that, when exploited, would allow apps to enable GPS silently. AFAIK, all of them are fixed at this point.
if impossible why so?
Privacy.
Related
I developed a app in my company to fetch the location of the device of my employees. They are field technicians so I need to know their location to assign different tasks. They are aware of the app installed in their cellphones, and I managed to forbid the uninstallation, but I cant prevent them to turn off the location services. There is a way to do that?
I was thinking in developing a Custom ROM and removing this option, so it always be on but i'am not a Android developer so I don't know if it is possible to do that.
Do you know any project about this? I searched in GitHub but i couldn't find any related really.
If you can help me I would be very grateful.
Thanks.
PS: I also have a Google G suite work profile in the cellphones,
but I didn't find any option to control device settings remotely.
Why can't you just ask them to not turn off their location? Then in your code simply check to see if the user has disabled the GPS and if so report that user to the server, after that you can deal with whoever did this in person.
Also, make sure your users don't cheat by using a FakeGPS app.
I have a few questions about privacy protection on Android and iOS. I've looked at Android documentation, but as a beginner I am not sure if I understand correctly (I put my understanding in square brackets). Especially, not finding the obvious way does not mean there are no workarounds to get the same information. Therefore, could any developer give advice on the following questions? Answers about iOS are also appreciated.
Can the user allow an app to use the microphone/camera/location only once (i.e. the system should always ask the user every time this app needs access)? [No, the "never ask again" option in the dialog is not meant for this purpose.]
If microphone/camera/location permission is given to an app, can it access these while in background? [Yes.]
Is it possible for an app (running in foreground) to obtain the list of other apps currently running or installed on the device? [Yes for installed ones, not sure about currently running ones.]
Can an app in background know what other apps are currently running and which one is in foreground? Can it possibly figure out whether the user is using the phone? [Not sure.]
Can an app (apart from the OS itself) take screenshots? [No.]
With regards to Android:
Can the user allow an app to use the microphone/camera/location only once (i.e. the system should always ask the user every time this app needs access)?
Not directly. They could have this effect by granting the permission, using the app, then going into Settings and revoking the permission. I suspect that few people do this. Offering a one-time-use-only option directly in the runtime permission dialog is an interesting option, though I suspect that Google would pass on it as making the flow too complicated.
If microphone/camera/location permission is given to an app, can it access these while in background?
Locations, yes, though with some limits on Android 8.0+ (for power savings). Microphone/camera, yes, though reportedly no longer starting with Android P.
Is it possible for an app (running in foreground) to obtain the list of other apps currently running or installed on the device?
Installed, yes. Running, not really, on newer versions of Android.
Can an app in background know what other apps are currently running
See above.
and which one is in foreground?
Not really, on newer versions of Android.
Can it possibly figure out whether the user is using the phone?
You can tell if the screen is on. IMHO, "whether the user is using the phone" has lots of possible definitions.
Can an app (apart from the OS itself) take screenshots?
I do not know how you are drawing the distinction here. An app can request screenshots and screen recordings through the media projection APIs on Android 5.0+, though this involves user acceptance. This acceptance is a one-time-per-process thing, so the user would have to grant access again in the future (akin to what you were seeking for microphone/camera/location).
So I need to detect in app if it was banned by Google no matter why. Just to inform the user about that (and that there will be no updates or whatever). So is there a way to detect the ban?
I'm pretty sure my app doesn't have any violation but like Carl said:
I afraid my app might get banned/suspended occasionally or eventually and Google typically does not warn about that. The reason is that Google is deliberately sudden and vague about enforcing its policies and this can result in innocent devs getting smacked unexpectedly.
And I know that this happens already and I know about such developers, they are usually small independent devs. Also I know that Google's support usually doesn't even answer emails about that fact. Moreover if you gonna try to discuss their decision about suspending your app on market this could result in permanent ban without any further details.
If app has Internet permission it can just bring up the app's listing page on the GP store. If not there - and if you have ability to access similar pages -then you might infer that the app was taken down.
Is this strictly a read-only thing or would I be able to actually modify the title/text/image of any of the current notifications on the device? If so how would I do this? I went through the documentation and couldn't find an answer. Thanks.
The only notifications you can modify are ones that your apps create. The NLS is for monitoring events only. Even with reflection you will get Permission errors, etc.
The only "work around" is a modded AOSP install or signing your app as "system" (which is a custom install solution also, unless you intend to have your apps ship with the device from the manufacturer / carrier).
OK, this is a little obscure, and my first question on stackoverflow.. I have searched around for an answer to this, but couldn't find anything about this very specific issue. Here goes:
I have created a very simple app which will run as a service in the background, every once in a while it will add latitude & longitude entries to an sqlite database table. It uses course location information (without checking whether it is available).
I have installed the app (from an apk) on my device and never had issues with it. However, I installed it on my mother's droid and kept getting "unexpectedly quit" errors each time I ran it. Realizing that she may not have had cell-tower based location enabled and that my app was not designed with best practices in mind (to have checked for that), I quickly enabled that option in her device settings and re-ran the app. I still got a force quit..so I rebooted.. re-ran.. no dice.
Then, on a weird hunch, I decided to install the app again, but this time the course-location was enabled at install time. To my surprise, the app worked flawlessly after that.
So.. I've not confirmed any of these "theories" but thought the great community at stackoverflow would be my best bet for some ideas:
Somehow, it matters at install time that my app has course-network
enabled..although, that would seem to be a glaring bug and not
likely (because so many apps would have this problem otherwise)
unless somehow installing from market and installing from an apk
will yield different results.
Somehow, my app, written with bad practices, corrupted something in
its installed location and was wiped upon reinstall...
If someone could shed light on this, by sharing some of what they know about these two ideas (or maybe point out an entirely different idea that would explain this behavior) that would be awesome.
ACCESS_COARSE_LOCATION is a must to be able to access to wi-fi aided location info. ACCESS_FINE_LOCATION only gives you GPS location data. If you enable both permissions, you can switch between these two sources.