android-permissions

android - “Exported receiver does not require permission” on receivers meant to receive from system services

最后都变了- 提交于 2019-12-17 15:34:56
问题 I have some receivers declared in my AndroidManifest : <!-- no warning --> <receiver android:name=".receivers.TriggerMonitoringBootReceiver" android:enabled="false"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> </receiver> <!-- no warning --> <receiver android:name=".receivers.ScanResultsReceiver" android:enabled="false"> <intent-filter> <action android:name="android.net.wifi.SCAN_RESULTS" /> </intent-filter> </receiver> <!-- warning :

Read logs from all apps on android from within an app for android 4.2+

ε祈祈猫儿з 提交于 2019-12-17 07:50:39
问题 I believe there have been changes to the ways apps can read logs in android post 4.2. But I wanted to know if I can read all the logs including system logs from logcat from within an app for current versions of android? If yes does it need some permission or not? 回答1: Unless you rooted you cannot do this since Jelly Bean. See this Android bug report and this related discussion. Quote: The change is that third party applications can no longer get the read logs permission, however every app can

Read font size from Settings

拜拜、爱过 提交于 2019-12-17 07:47:16
问题 This question is a almost dublicate of Android App: how to read Font Size under Settings? I read the answer of CommonsWare which points to use Settings.System.FONT_SCALE . So I wrote this few lines: float scale = -66.6f; try { scale = android.provider.Settings.System.getFloat(getContentResolver(), android.provider.Settings.System.FONT_SCALE); } catch(SettingNotFoundException e) { Log.e(getClass().getSimpleName(), "Error: ", e); } Toast.makeText(this, "scale=" + scale, Toast.LENGTH_LONG).show(

Android: what to choose for requestcode values?

陌路散爱 提交于 2019-12-17 07:20:13
问题 Methods like ActivityCompat.requestPermissions require that I pass them a requestcode that I can later test in a callback (in this case onRequestPermissionsResult ). Is there some best practice sort of value I'm supposed to pass in the requestcode? I've noticed that if I just enter a random int I sometimes get an error like this: java.lang.IllegalArgumentException: Can only use lower 8 bits for requestCode 10-25 16:47:43.652 8315-8315/? E/AndroidRuntime: FATAL EXCEPTION: main 10-25 16:47:43

checkSelfPermission method is not working in targetSdkVersion 22

允我心安 提交于 2019-12-17 04:55:06
问题 CheckSelfPermission method is not working as expected and it is always returning zero in android 6.0(Marshmallow). Because the target sdk is 22 and i am using http Client for network connection. Following is the code snippet. private void insertDummyContactWrapper() { List<String> permissionsNeeded = new ArrayList<String>(); final List<String> permissionsList = new ArrayList<String>(); if (!addPermission(permissionsList, Manifest.permission.ACCESS_FINE_LOCATION)) permissionsNeeded.add("GPS");

How to request permissions from a Service in Android Marshmallow

依然范特西╮ 提交于 2019-12-17 02:13:06
问题 In Android Marshmallow, permissions should be requested at runtime when they are needed, instead of all at once when an app is installed. However, I can only seem to request permissions from an Activity, which is a problem since my app contains only Services. (Why is that, you might ask? The app has an Android Wear watch face bundled inside, and all the phone does is look up photos nearby to send to the watch - no Activity needed. But it does require location permissions.) So, is there any

How to request permissions from a Service in Android Marshmallow

╄→尐↘猪︶ㄣ 提交于 2019-12-17 02:12:10
问题 In Android Marshmallow, permissions should be requested at runtime when they are needed, instead of all at once when an app is installed. However, I can only seem to request permissions from an Activity, which is a problem since my app contains only Services. (Why is that, you might ask? The app has an Android Wear watch face bundled inside, and all the phone does is look up photos nearby to send to the watch - no Activity needed. But it does require location permissions.) So, is there any

Latest update on enabling and disabling mobile data programmatically

帅比萌擦擦* 提交于 2019-12-17 02:09:19
问题 Although this is a "duplicate", the current answers are out of date and, mostly, no longer apply. I thought it would be good to provide an updated resource here, if possible, to save people time, as I have just done, researching this issue. I've been googling around to see the latest information on being able to enable and disable mobile data from within an app (if wifi is not available). This is one of the latest things I can find: Did you know you can no longer Disable/Enable Data on

List of Android permissions normal permissions and dangerous permissions in API 23? [duplicate]

时光怂恿深爱的人放手 提交于 2019-12-16 22:35:27
问题 This question already has answers here : Android permission doesn't work even if I have declared it (13 answers) Closed last year . Which permissions need for requesting permissions at run time of API 23? 回答1: As of API level 23, the following permissions are classified as PROTECTION_NORMAL: ACCESS_LOCATION_EXTRA_COMMANDS ACCESS_NETWORK_STATE ACCESS_NOTIFICATION_POLICY ACCESS_WIFI_STATE BLUETOOTH BLUETOOTH_ADMIN BROADCAST_STICKY CHANGE_NETWORK_STATE CHANGE_WIFI_MULTICAST_STATE CHANGE_WIFI

Android M - check runtime permission - how to determine if the user checked “Never ask again”?

对着背影说爱祢 提交于 2019-12-16 21:23:09
问题 According to this: http://developer.android.com/preview/features/runtime-permissions.html#coding an app can check for runtime permissions and request permissions if it hasn't been granted already. The following dialog will be displayed then: In case the user declines an important permission, imo an app should display an explanation why the permission is needed and what impact declining has. That dialog has two options: re-try again (permission is requested again) deny (app will work without