Commit 60413705 authored by Suhail Alkowaileet's avatar Suhail Alkowaileet Committed by GitHub

Merge pull request #217 from jspricke/fix_permissions

Request more permissions at run time
parents 44ddc2f0 a323bd35
......@@ -408,6 +408,11 @@ public class AllInOneActivity extends AbstractCalendarActivity implements EventH
}
if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(this,
Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
PERMISSIONS_REQUEST_WRITE_CALENDAR);
}
}
@Override
......
......@@ -42,6 +42,7 @@ import android.provider.CalendarContract.Calendars;
import android.provider.CalendarContract.Colors;
import android.provider.CalendarContract.Events;
import android.provider.CalendarContract.Reminders;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
......@@ -360,6 +361,13 @@ public class EditEventFragment extends Fragment implements EventHandler, OnColor
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(EditEventFragment.this.getActivity(),
Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(EditEventFragment.this.getActivity(), new String[]{Manifest.permission.READ_CONTACTS},
0);
}
if (savedInstanceState != null) {
if (savedInstanceState.containsKey(BUNDLE_KEY_MODEL)) {
mRestoreModel = (CalendarEventModel) savedInstanceState.getSerializable(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment