How to use code to open android.permission.SYSTEM_ALERT_WINDOW permission - java

In my app, I need to use android.permission.SYSTEM_ALERT_WINDOW permission. Now I know to go to setting to open it. But some of the application is automatically opened. I want to know how to do it

If i got it right, you want to ask the user for some permissions on app launch. There's a great library to help you do that in Android :
Github link for the Permission dispatcher library
You can also check these libraries :
App-Runtime-Permissions-Android
Assent
MarshmallowPermissionManager

Every app that requests the SYSTEM_ALERT_WINDOW permission and that is installed through the Play Store (version 6.0.5 or higher is required), will have granted the permission automatically.
If instead the app is sideloaded, the permission is not automatically granted. You can try to download and install the Evernote APK from apkmirror.com. As you can see you need to manually grant the permission in Settings -> Apps -> Draw over other apps.
It is a new behaviour introduced in Marshmallow 6.0.1.
If you want the app to be sideloaded, you show manually show a prompt and direct the user to enable Draw over other apps permissions from the settings. Have a look at Requesting permissions

Related

React Native Publishing APP on Play Store Rejected (permissions)

I have just completed my app which I have React Native using Expo. It is my first time uploading an APP to Play Store. After I got finished uploading my APP and all the requirements I got an Email from Google that my APP got Rejected, and I have no idea how to fix the issues they have listed.
=====================================================================
Here are the reasons:
The declared function DEVICE_AUTOMATION is allowed, but not approved for the specific permissions that are listed in your manifestREAD_SMS . These excess permissions READ_SMS must be removed from your app manifest
The declared functionality DEVICE_AUTOMATION is determined to be unnecessary or not aligned with the core functionality of your app.
=====================================================================
Any help would be grateful.
Best Regards
Musayyab
Starting from Jan 9, 2019, Google starts restricts the use of high risk or sensitive permission including SMS or Call Log.
According to mail, you can't use READ_SMS permission in your application. (It does not matter what application make by whatever language) Indeed, Google just judge 'Your application doesn't need READ_SMS function'.
If you tried to use READ_SMS as OTP(or Phone Authentication), You can use SMS Retriever API to achieve almost same feature.
In other cases, there are no alternatives available at this time.
Android apps have something called Permissions which the app tell s the phone what it would like to do. The purpose of these is to protect the privacy of the Android User.
Google Play has recently got stricter in what apps it will allow to use some of these permissions, as they are often used by abusive apps. One of these permissions is READ_SMS. If an app is granted this permission it is allowed to read all of the users SMS messages.
It sounds from your comment like you don't want your app to read the users SMS messages. So in this case the check worked - your app was asking for a permission it didn't need. You should remove the request for the READ_SMS permission from your app.
There are instructions on editing the permissions in a react native app here. So possibly you added this permission to your AndroidManifest.xml file. If you did, then you should remove it.
If you didn't add it yourself, it is a possible a bad third-party library you added to your app added the permission. If so you should stop using that library.

Is there a path in the Emulator that can be programmatically written when the permission is denied?

In the lower Android version, /sdcard/Download can be read and written, but from Android6 when I use code File file = new File("/sdcard/Download/TestResults.xls"); it will throw exception permission denied, I want to find are there a path in emulator that jave code can directly use to create File without asking permission?
Android-M ie, API 23 introduced Runtime Permissions for reducing security flaws in android device, where users can now directly manage app permissions at runtime.
You should to use permission API version above 23.
Refer this Android marshmallow request permission?

Android permissions using admob - are they necessary?

Could you help me?
I have a question about permission required by using admob in my application. Are these permissions really necessary? I've found some app on PlayStore they are using ads without any permissions? How can I do it?
Thanks for your suggestions
The internet access permission does not by default show up when you are downloading an app under the permissions that the app uses (i.e. "The app requires no special permissions to run." In this example the app could still use internet access. Google simply gave every app the permission, however you still need to declare that you use the permission in your application). If you have checked the permissions manually (using a program) and the application does not use the internet access permissions then the "ads" are likely just pictures that when clicked open your browser. Thus they require no internet access.
However to use admob the INTERNET ACCESS permission is required, the reason you don't see it is because Google no longer states whether application have this permission or not.
Internet permission is required now. Although, existing app with no Internet permission still works.

How can my app access admin level privileges on non-rooted device?

Android requires super user for deleting, modifying or reading anything in the root directory except system which is read only.
However, I have noticed that even without a rooted device, some applications are able to take advantage of these processes. For example, Norton is able to do device wipes on non-rooted phones. Is there a way to grant my application similar access?
An application with Administrator Rights can use the Device Administration API. This API offers the ability to wipe the device.
Using this, it doesn't need any super-user permissions, it only needs device administrator rights.
To summarize how to use the Device Administration API:
You need a resource file declaring policies needed by your app
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
<uses-policies>
<wipe-data />
</uses-policies>
</device-admin>
You need to implement a DeviceAdminReceiver to react to various administration event your app is interested in. (an empty implementation can be enough if you are only interested in wipe-device) (more details on how to setup this receiver: here)
You need the BIND_DEVICE_ADMIN permission
At some point (probably at start up) your app must trigger ACTION_ADD_DEVICE_ADMIN to ask to the user to grant "Device Administration Rights" to your app. (once those rights are granted, there is no reason to ask them again. The user always have the ability to un-grant those rights from the Settings app)
When your setup is correct (and if the user grant Device Admin rights to your app), you can invoke the DevicePolicyManager:
DevicePolicyManager devicePolicyManager = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE);
devicePolicyManager.wipeData(0);
Note that an app with device administrator rights cannot be un-installed. The user needs to manually remove those rights (with the Settings app) before being able to un-install it.

Android, root, whitelist

How can I create whitelist with root-granted apps? Other apps must be denied whithout any prompt.
I'm looking for existing solution or some advice how to write app with this features.
You should checkout Superuser on the market. This app can manage what apps have root access to the device.
use
Download Magisk Manager
solutions 1
its have feature for app selection for pregranted and for other apps
solutions 2
first manually grant permission from Magisk app
set default Aotometic Response -> Deny
be free to ask for more help :)

Categories