Android M Permissions : Confused on the usage of shouldShowRequestPermissionRationale() function

After M Preview 1, if the dialog is displayed for the first time, there is no Never ask again checkbox. If the user denies the permission request, there will be a Never ask again checkbox in the permission dialog the second time permission is requested. So the logic should be like this: Request permission: if … Read more

Android marshmallow request permission?

Open a Dialog using the code below: ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 1); Get the Activity result as below: @Override public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { switch (requestCode) { case 1: { // If request is cancelled, the result arrays are empty. if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { // permission was … Read more

onRequestPermissionsResult not being called in fragment if defined in both fragment and activity

Edited answer to cover broader issues I think you are confusing the method for fragment and activity. Had a similar issue my project last month. Please check if you have finally the following: In AppCompatActivity use the method ActivityCompat.requestpermissions In v4 support fragment you should use requestpermissions Catch is if you call AppcompatActivity.requestpermissions in your … Read more

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

Developer Preview 2 brings some changes to how permissions are requested by the app (see also http://developer.android.com/preview/support.html#preview2-notes). The first dialog now looks like this: There’s no “Never show again” check-box (unlike developer preview 1). If the user denies the permission and if the permission is essential for the app it could present another dialog to … Read more

How can I programmatically open the permission screen for a specific app on Android 6.0 (Marshmallow)?

According to the official Marshmallow permissions video (at the 4m 43s mark), you must open the application Settings page instead (from there it is one click to the Permissions page). To open the settings page, you would do Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); Uri uri = Uri.fromParts(“package”, getPackageName(), null); intent.setData(uri); startActivity(intent);

getColor(int id) deprecated on Android 6.0 Marshmallow (API 23)

Starting from Android Support Library 23, a new getColor() method has been added to ContextCompat. Its description from the official JavaDoc: Returns a color associated with a particular resource ID Starting in M, the returned color will be styled for the specified Context’s theme. So, just call: ContextCompat.getColor(context, R.color.your_color); You can check the ContextCompat.getColor() source … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)