android-permissions

Android O can't receive broadcast Intent.ACTION_NEW_OUTGOING_CALL

心不动则不痛 提交于 2020-01-23 11:38:39
问题 In my application, I can receive android.intent.action.PHONE_STATE but can't receive Intent.ACTION_NEW_OUTGOING_CALL on android O . If I use android N or android M everything work fine. I have register first broadcast in AndroidManifest file and second in foreground service , but none of them can receive Intent.ACTION_NEW_OUTGOING_CALL , only can receive android.intent.action.PHONE_STATE . If anyone know how to fix it, please post your answer, thanks in advance. 回答1: But I am still confused,

Android O can't receive broadcast Intent.ACTION_NEW_OUTGOING_CALL

自闭症网瘾萝莉.ら 提交于 2020-01-23 11:38:05
问题 In my application, I can receive android.intent.action.PHONE_STATE but can't receive Intent.ACTION_NEW_OUTGOING_CALL on android O . If I use android N or android M everything work fine. I have register first broadcast in AndroidManifest file and second in foreground service , but none of them can receive Intent.ACTION_NEW_OUTGOING_CALL , only can receive android.intent.action.PHONE_STATE . If anyone know how to fix it, please post your answer, thanks in advance. 回答1: But I am still confused,

Android: java.lang.IllegalStateException: No receiver allowed to receive com.google.android.c2dm.permission.SEND

孤街醉人 提交于 2020-01-17 11:17:15
问题 Hey guys I am trying to implement GCM to my app. However I keep getting this annoying error for some reason: java.lang.IllegalStateException: No receiver allowed to receive com.google.android.c2dm.permission.SEND Here is my manifest file: <!-- GCM --> <!-- GCM requires Android SDK version 2.2 (API level 8) or above. --> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="com.google

Android: java.lang.IllegalStateException: No receiver allowed to receive com.google.android.c2dm.permission.SEND

老子叫甜甜 提交于 2020-01-17 11:17:04
问题 Hey guys I am trying to implement GCM to my app. However I keep getting this annoying error for some reason: java.lang.IllegalStateException: No receiver allowed to receive com.google.android.c2dm.permission.SEND Here is my manifest file: <!-- GCM --> <!-- GCM requires Android SDK version 2.2 (API level 8) or above. --> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="com.google

Android Location runtime permissions

允我心安 提交于 2020-01-17 08:02:26
问题 I know that this type of questions occurs very often on stack overflow. I have looked at many posts with similar questions, read the official documentation but finally I anyway cannot understand how do the runtime permissions work in android. Firstly I get the following error: Call requires permissions which may be rejected by user When I generate the code that Android Studio suggests, I get this: if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) !

Android Location runtime permissions

不想你离开。 提交于 2020-01-17 08:01:05
问题 I know that this type of questions occurs very often on stack overflow. I have looked at many posts with similar questions, read the official documentation but finally I anyway cannot understand how do the runtime permissions work in android. Firstly I get the following error: Call requires permissions which may be rejected by user When I generate the code that Android Studio suggests, I get this: if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) !

Android 6.0.1 - Permission issue = wifiManager.getScanResults() returns 0

一个人想着一个人 提交于 2020-01-15 08:18:29
问题 The permissionsList.add() doesn't work but MainActivity.this.requestPermissions() works fine. The issue is that it brings a dialog box asking if the user allow the location permission. Why adding the permission does not work? Is there a way to avoid the dialog box? See my minimal code below: public class MainActivity extends AppCompatActivity { WifiManager wifiManager; WifiBroadcastReceiver broadcastReceiver; Context context; @Override protected void onCreate(Bundle savedInstanceState) {

Neither user 10036 nor current process has android.permission.DEVICE_POWER.

无人久伴 提交于 2020-01-15 03:42:08
问题 I need to power off device by button on my application. I add permission to manifest file: <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="13" /> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.DEVICE_POWER"/> And use powerOff method on click button: void powerOff(){ PowerManager pm = (PowerManager) getSystemService(this.POWER_SERVICE); pm.goToSleep(SystemClock.uptimeMillis()); } When I click button I get error:

Auto grant permissions for Espresso UI Testing

我是研究僧i 提交于 2020-01-15 03:22:07
问题 I'm trying to avoid having to manually grant permissions on every single UI test built with Espresso. I have tried: @Rule public GrantPermissionRule permissionRule = GrantPermissionRule.grant( android.Manifest.permission.INTERNET, android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION.....) and @Before public void grantPhonePermission() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {

On checking for permissions dynamically in android apps

假如想象 提交于 2020-01-13 18:58:37
问题 Following up on my previous question on android permissions enforcement at runtime, I found that there are many different ways in android which an app can verify the permissions possessed by the calling (client) app. This includes calls like checkCallingPermission, checkCallingOrSelfPermission, checkCallingUriPermission, checkCallingOrSelfUriPermission, checkPermission, checkUriPermission. As far as I have gone through the android documentation, I am able to find only these calls pertaining