I am using a service that on boot starts up and begins to check for location updates. Once i deny location access on permission popup now thanks to Android M my service crashes once the phone boots up.
Since i have no activity in this case the call to requestPermissions()
returns a ClassCastException
as my service Context
cannot be cast to an activity.
My method call:
ActivityCompat.requestPermissions((Activity) mContext, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, REQUEST_COARSE_LOCATION);
Is there any solution so far to this OR do I have to revoke the service rights to NOT run in such a state.