Does this work without the user's permission? - java

Because I can't post a comment, I am asking a question instead. I am not a java programmer, but I am wondering if it is possible to turn on the GPS without the user's permission. I found this answer: https://stackoverflow.com/a/33555732. I don't know java, but from what I can see from the comments is that it tries to turn on the GPS and if that doesn't work, it will prompt the user a dialog? Is that correct? Is that code really able to turn on the GPS without the user's permission?

but I am wondering if it is possible to turn on the GPS without the user's permission
No.
but from what I can see from the comments is that it tries to turn on the GPS and if that doesn't work, it will prompt the user a dialog?
Correct.
Is that code really able to turn on the GPS without the user's permission?
No, because the user is giving permission through the dialog. Play Services is enabling GPS based upon the response to the dialog.

You cannot access location without user's permission, because to turn on the GPS you can access user's location. Today you can ask to permission dynamically using Requesting Permission at Run Time, take a look: https://developer.android.com/training/permissions/requesting.html

Related

how to remove the third permission option

I've already googled this question but haven't found anything yet, so I need your help. How to remove the third option of permission to the memory, because if the user accidentally clicks on it, it will be necessary to go to the settings and allow the permission to the program manually, and since in general 30-40% of users are able to do this, only one will have to reinstall the program .
As people in the comments have said, it is a system dialog and you cannot change it. If you want to help users find your app's settings you can try sending them there.
Also note that according to the docs
Starting in Android 11 (API level 30), if the user taps Deny for a specific permission more than once during your app's lifetime of installation on a device, the user doesn't see the system permissions dialog if your app requests that permission again. The user's action implies "don't ask again."
So you have to deal with permanent denials even if there isn't a dedicated button.

Always Allow Background Location Android 11

I'm currently working on an app that requires users to have background location turned on as it is a core element.
Currently the app requests location and functions properly, but the user must manually go into settings to change to allow always. However, our users are generally not technically-savvy individuals, so I would like to make it so they can click allow always right when prompted for location.
I have been researching this topic for a few hours now and I cannot find a simple solution that doesn't require use of a library. According to Google's documentation, https://developer.android.com/training/location/permissions#request-background-location, this should be simple using the function getBackgroundPermissionOptionLabel(). I am unsure of the context to use this, and searching the function itself has not yielded any results.
I have also found their sample project,https://github.com/android/location-samples/tree/master, which includes LocationUpdatesPendingIntent that prompts the user for permissions but only shows a link to go to the location permissions settings page.
Currently here is exactly what we use for requesting the location permission, which is identical to what the example uses.
ActivityCompat.requestPermissions(MainActivity.this,
new String[] {
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_BACKGROUND_LOCATION
},
REQUEST_PERMISSIONS_REQUEST_CODE);

Turning on and off GPS programmatically in all android version

I am working on a location based application. I want to turn on/off GPS through code. I found a solution from this [link]: Turning on and off GPS programmatically in android 4.0 and above? but app is crashing when i run this portion.
Please guide me with proper solution.
I want to turn on/off GPS through code
There is "enabled/disabled", and there is "on/off". "Enabled/disabled" determines whether any app can get GPS fixes. "On/off" determines whether the device is trying to get GPS fixes right now. GPS can only be "on" if it is "enabled".
If you request locations from the GPS_PROVIDER, and GPS is enabled, the GPS radio will turn on. If you stop requesting locations from the GPS_PROVIDER, and no other app is requesting locations from the GPS_PROVIDER, the GPS radio will turn off. Depending on how you configure your request for locations (e.g., once an hour), the GPS radio may turn off and on to save battery life, even while your request is outstanding. Hence, Android developers do not worry much about "on/off" — developers just request locations, and the hardware takes care of powering on and off the GPS radio as needed.
Your link really refers to "enabled/disabled". Android removed the ability for apps to enable and disable GPS back in Android 1.5, for privacy reasons. Malware authors have continued to try to find ways to get around this, because malware authors are not interested in user privacy. The link you cited was an exploit for a flaw in Android that allowed apps to enable and disable GPS. That exploit was fixed years ago. I am not aware of a current exploit that allows apps to enable and disable GPS.

Detect when a failed unlock happens

I've been looking around for a while to find out what happens when a user fails to unlock the phone.
Basically I'm trying to take a picture if a user fails to authenticate. But all I can find is ACTION_USER_PRESENT - Does anyone know if this is possible?
Thanks
You can't access the login attempts of the android lockscreen.
If you want to build an app that does that you have to create your own lockscreen. However, this is not a "real" lockscreen you can't edit in the android settings. This would be an App which acts like a lockscreen and has the same permissions. Because you can check if a phone is locked, that way the app would activate its own "lockscreen" (which is basically a normal form with many permissions) whenever the phone gets locked (you probably have to deactivate the original lockscreen).
Look into this link, there you have all options regarding the original lockscreen.

Is it possible to have a 'background' Facebook App?

I need a Facebook application that kind of sit in the 'background' of user operations. Once the app is installed by the user, it will keep on sending the user's status updates, new friend connections etc to another web app of mine. It will keep on getting info no matter whether the app page is open or not.
My question is -- is this possible? So far, I've played around a simple iFrame app written with the Java API. It seems that it can only perform data collections whenever the page is hit.
EDIT: Privacy is definitely a valid concern here. But the application will definitely prompt for permission even if FB API is not built in to do so.
You can ask the user for the offline_access extended permission by using the fb:prompt-permission FBML tag: <fb:prompt-permission perms="offline_access">Can I have access to your data all the time?</fb:prompt-permission>, store the user's session key in your database and then query the Facebook API as needed. (You may need other extended permissions if there's other data you want to access that isn't a standard API call.)
Note that this isn't against the terms of service, but you won't be allowed to store any of the data you receive for more than 24 hours.
Tho I wont suggest it, but if you create an "app" which has an associated user account, which you then ask the user of the facebook app to add as a friend, then you can achieve what you want in the question.
e.g., lets say your app was iFacebook - then you create a regular user account called iFacebook Friend, and ask users of your iFacebook app to add iFacebook Friend to their friends(*) list. Then you can scrape data off your app users via the regular facebook account 'iFacebook Friend'.
However, doing so is probably going to violate some usage policies of facebook, and can likely to get you banned, or reported as a privacy violating app. However, if what your app does is useful enough, some people will happily let privacy go...
(*) you can entice them into doing this by giving incentives, such as bonus points, extra exclusive 'stuff' that only those who have added the friend would get.
Nope. Facebook doesn't want apps having too much user data in general, and certainly doesn't want them accessing it when the user is not actively interacting with the application.
Heck, infinite session keys aren't even supported anymore. Those still around have all been grandfathered in.

Categories