Skip to content
This repository has been archived by the owner on May 7, 2023. It is now read-only.

Commit

Permalink
Add permission request to sample application
Browse files Browse the repository at this point in the history
  • Loading branch information
se-bastiaan committed Apr 2, 2016
1 parent 2d99b59 commit 9878522
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@

package com.github.se_bastiaan.torrentstreamer.sample;

import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
Expand Down Expand Up @@ -78,6 +82,15 @@ protected void onCreate(Bundle savedInstanceState) {
progressBar.setMax(100);
}

@Override
protected void onResume() {
super.onResume();

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

View.OnClickListener mOnClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
Expand Down

0 comments on commit 9878522

Please sign in to comment.