Android Question Handle the permissions request response

Croïd

Active Member
Licensed User
Longtime User
how can I translate with PackageManager ?

http://developer.android.com/training/permissions/requesting.html#handle-response

B4X:
@Override
public void onRequestPermissionsResult(int requestCode,
        String permissions[], int[] grantResults) {
    switch (requestCode) {
        case MY_PERMISSIONS_REQUEST_READ_CONTACTS: {
            // If request is cancelled, the result arrays are empty.
            if (grantResults.length > 0
                && grantResults[0] == PackageManager.PERMISSION_GRANTED) {

                // permission was granted, yay! Do the
                // contacts-related task you need to do.

            } else {

                // permission denied, boo! Disable the
                // functionality that depends on this permission.
            }
            return;
        }

        // other 'case' lines to check for other
        // permissions this app might request
    }
}
 

Croïd

Active Member
Licensed User
Longtime User
Thanks Erel, but I wish to interact with permission, if user click No, I'd like to send a new msgbox.
my problem is located :

if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED)
 
Upvote 0

Croïd

Active Member
Licensed User
Longtime User
Yes I prepare for future Apps, and I want send second message, if deny.

permission.png
 
Upvote 0

Croïd

Active Member
Licensed User
Longtime User
In the near future there will be better support for the new permissions system. For now just set the targetSdkVersion to a lower version and it will work on all devices.

Thanks Erel, i will wait
 
Upvote 0
Top