^

Check For Permission and Request

Article 17 in Android-Java

2020-08-15 03:37:51 from bugfish
Check For Permission and Request
Android-Java / Hints
Last Review on: 2021-08-02 08:39:55 | Hits: 311

This is Example for Internet Permissions

Android Manifest XML (for every Permissoin u need one of this fitting block)

    <!-- Declare Use Of Internet -->
        <uses-permission android:name="android.permission.INTERNET"/>

Java Content:
if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.INTERNET)
!= PackageManager.PERMISSION_GRANTED) {

int MY_PERMISSIONS_REQUEST_INTERNET = 0;
ActivityCompat.requestPermissions(MainActivity.this,
new String[]{Manifest.permission.INTERNET},
MY_PERMISSIONS_REQUEST_INTERNET);

}
 

May Replace "Manifest.permission.INTERNET" with that one needed.

 

I do not guarantee the reliability of the information given here, the code described on this page is executed at your own risk and in the event of damage or other unforeseeable consequences I am in no way responsible or liable.
Comment Section
Currently 0 Upvotes!
captcha image

System - 2021-01-01 17:47:44
We appreciate comments on our site!

Theme
2
This Website is using Session Cookies for Site Functionality and AWStats.