I am using Room database with external storage db. In android 11 database can't read by programmatic, so i added below permission in my manifest file and get permission by user.
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" tools:ignore="ScopedStorage"/>
Permission code for android 11
Intent intent = new Intent();
intent.setAction(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
startActivity(intent);
It working fine. After upload the apk to playstore they reject the app for the reason of
Not adhering to All files access permission policy
How i can solve this
Related
I have developed a little BLE App for Android which connects with my mobile music Box.
Everything works fine on my phone (Android 9). So I bought a tablet (Android 9) and there onScanResult is never called, but when I search with Android board-function I see the Bluetooth device.
ACCESS_FINE_LOCATION
BLUETOOTH
BLUETOOTH_ADMIN
is set and Location is set to on.
if your bluetooth is on then give runtime permission of , ACCESS_FINE_LOCATION and ACCESS_CORSE_LOCATION and still you are facing this issue then gps on and restart scanning its working fine.
Required permission for BLE,
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
and check gps is enable or not
private fun enableLocation(): Boolean {
val service = activity?.getSystemService(Context.LOCATION_SERVICE) as LocationManager
val enabled = service.isProviderEnabled(LocationManager.GPS_PROVIDER)
return enabled
}
and if return false then
val intent = Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS)
startActivity(intent)
for enable your gps progrmatically and if true then scan your device.
ACCESS_FINE_LOCATION could be declared in manifest but it's not treated as granted by default. Have you requested for granting this permission in runtime? If not, request for it in runtime or just go to permissions section in your app settings and grant it manually.
Does anyone know of a way to retrieve the Device ID found under Settings -> About tablet -> System updates -> Software update settings under the Device information header in Android versions 4.x or 5.x?
Agreed with #G.hakim , but additional to that, this API requires android.permission.READ_PHONE_STATE permission.So you need to declare the permission in AndroidManifest.xml if you want to use this api:
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
If i'm not wrong you are looking for your mobile phone's device id which you can get using these line of code
TelephonyManager tm = (TelephonyManager)context.GetSystemService(Context.TelephonyService);
deviceId = tm.DeviceId;
Also requires the following permission:
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
Also after Android Marshmallow Or API 23 you need to ask for permissions on the fly the code reference for that can be found here:
https://blog.xamarin.com/requesting-runtime-permissions-in-android-marshmallow/
java.lang.SecurityException: Permission Denial: starting Intent {
act=android.intent.action.CALL dat=tel:xxxxxxxxxx
cmp=com.android.server.telecom/.components.UserCallActivity } from
ProcessRecord{9a25695 2469:in.preciseit.dialhingoli/u0a59} (pid=2469,
uid=10059) with revoked permission android.permission.CALL_PHONE
here is what i want to ask in Logcat error
I am using call function onClicklistener.
+
please define following permission in menifest file and Try. And then after not work then Read This url for marshmallow runtime permission
<uses-permission android:name="android.permission.CALL_PHONE"/>
Android 6 (SDK 23) allows users to revoke permissions from an app.
Click to read more
I do not understand what is going on here.
I get permission denied try trying to access External Storage on HTC Wildfire S although i set
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
in the manifest file.
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state))
return false.
File storage= new File(Environment.getExternalStorageDirectory(),FILENAME);
By calling storage.createNewFile(); i get permission denied.
Stacktrace: java.io.IOException: Permission denied
NOTE: The same application is working correctly on all Android Samsung devices. I have the problem only on HTC and Sony devices
Thanks for your help
Is your device plugged in your PC (USB) ? Did you check the status of your SDCard (how it is mounted, USB options while plugged in) ?
For this error : java.io.IOException: Permission denied
The destination file may aldready exist. Did you check that ?
I get the anwser by myself.
Quiet simple: i just use internal storage instead of
External one.
Iam getting this error on my log
07-06 06:22:07.419: ERROR/AndroidRuntime(2618): java.lang.SecurityException: SECURE PERMISSION: Neither user 10070 nor current process has android.permission.WRITE_SECURE_SETTINGS.
I used like this
in activity file
private static final String SECURE_SETTINGS = android.Manifest.permission.WRITE_SECURE_SETTINGS;
mContext.enforceCallingOrSelfPermission(SECURE_SETTINGS,
"BLUETOOTH_ADMIN permission");
in manifest file
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
Why does it give error?
The WRITE_SECURE_SETTINGS permission is not available to apps which aren't part of the firmware because secure settings are designed to be secured against modification by third party apps.
You can only read this settings if your phone doesn't have root access. To enable bluetooth you can use this references http://developer.android.com/guide/topics/wireless/bluetooth.html.
However, this is above sdk5... I'm not really sure if it is a good idea to use bluetooth with sdk3. I also wanted to do an app which uses bluetooth and I had to switch my target level to above 2.0.1 because bluetooth below this sdk is not supported very well.