Skip to content

Instantly share code, notes, and snippets.

@DaveNOTDavid
DaveNOTDavid / ext_strge_prmns_sample.txt
Last active Feb 28, 2017
Requesting/granting in-app external storage permissions for devices Marshmallow (6.0/API 23) and above for a sample music player app (https://code.tutsplus.com/tutorials/create-a-music-player-on-android-project-setup--mobile-22764)
View ext_strge_prmns_sample.txt
/**
* Code snippet for requesting/granting permissions properly for dangerous permissions
* such as external storage for devices M (6.0/API 23) and above. For sampling purposes,
* snippet includes only the onCreate() and onRequestPermissionsResult() methods within
* MainActivity.
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);