Context context;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Context context = (Permission) this;
// In an actual app, you'd want to request a permission when the user
// performs an action
// that requires that permission.
if (Build.VERSION.SDK_INT >= 23) {
getPermissionToReadUserContacts();
}
}
// Identifier for the permission request
private static final int READ_CONTACTS_PERMISSIONS_REQUEST = 1;
// Called when the user is performing an action which requires the app to
// read the
// user's contacts
public …Run Code Online (Sandbox Code Playgroud) android android-activity android-permissions android-6.0-marshmallow