What is android permissions and security
Android Security :
- Android Applications installs with unique Group Id
- each Android application is started in its own process
- Each application's file is private to this user, Other applications cannot access this files
- Every android applications are isolated from other running applications
Android Permissions:
- Android operating system has permission Model
- Android apps must be required few permissions Example: camera, internet, contacts etc,
- permissions we can define on manifest file and java file
Permissions before API level 23:
- before API level 23 we need to ask persimmons before installing an app or application
- if user denied the permissions applications cannot install, the user must grant all permissions
- permissions cannot be denied after installations of an app.
Android Runtime Permissions:
- API level 23 onwards introduced runtime permissions,
- target level 23 onwards we need to define runtime permissions on the app
- we have two types of permissions Levels those are normal and dangerous permissions.
Normal permissions:
Normal permissions are harmless for user Privacy or Operations of other applications
Example: internet permissions, etc
Dangerous permissions:
these permissions are harmful to user Privacy, example: contacts details ets.
int permissionCheck = ContextCompat.checkSelfPermission(Activity_Persmissions.this,
Manifest.permission.WRITE_CALENDAR);
if (ContextCompat.checkSelfPermission(Activity_Persmissions.this,
Manifest.permission.READ_CONTACTS)
!= PackageManager.PERMISSION_GRANTED) {
// Should we show an explanation? if (ActivityCompat.shouldShowRequestPermissionRationale(Activity_Persmissions.this,
Manifest.permission.READ_CONTACTS)) {
// Show an explanation to the user *asynchronously* -- don't block // this thread waiting for the user's response! After the user // sees the explanation, try again to request the permission.
} else {
// No explanation needed, we can request the permission.
ActivityCompat.requestPermissions(Activity_Persmissions.this,
new String[]{Manifest.permission.READ_CONTACTS},
MY_PERMISSIONS_REQUEST_READ_CONTACTS);
// MY_PERMISSIONS_REQUEST_READ_CONTACTS is an // app-defined int constant. The callback method gets the // result of the request. }
No comments