0

I'm trying to get the users permission in android to write and read to the calendar. However I get an error on the following code:

    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_CALENDAR) != PackageManager.PERMISSION_GRANTED) {
        ActivityCompat.requestPermissions( this, new String[] {  Manifest.permission.READ_CALENDAR  },
                MY_PERMISSIONS_REQUEST_READ_CALENDAR);
    }

It says: can not resolve symbol MY_PERMISSIONS_REQUEST_READ_CALENDAR. I can't quite figure out what it's supposed to be.

Mischa
  • 2,069
  • 4
  • 23
  • 32
  • Does [this](http://stackoverflow.com/questions/37250418/call-requires-permission-for-content-uri-in-calender) help you? – Vucko Jul 10 '16 at 12:01

1 Answers1

2

As stated here:

requestPermissions(Activity activity, String[] permissions, int requestCode)

requestCode int: Application specific request code to match with a result reported to onRequestPermissionsResult(int, String[], int[]).

So this last parameter is just a requestCode (int) of your choice. It's good practice to declare this as a final int in your class.