Check For Permission and Request

Knowledge Base Entry: #17
^Top
<< Back
Mobile-Menu










Check For Permission and Request
Category: Android/Snippets
Author: Bugfish
Created at: 2020-08-15 03:37:51
Modified at: 2025-09-20 10:57:37
Directs Hits: 864

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.

 

Caution: 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.
This Website is using Session Cookies for Site Functionality.