Skip to content
Permalink
Browse files
front: Request less permissions
  • Loading branch information
fzurita committed Feb 27, 2016
1 parent cf4d869 commit 42012bce35e9525e519427e1aad621ac23be365f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
@@ -18,7 +18,6 @@
android:targetSdkVersion="23" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />

@@ -67,7 +67,7 @@ public class SplashActivity extends AppCompatActivity implements ExtractAssetsLi
static final int PERMISSION_REQUEST = 177;

//Total number of permissions requested
static final int NUM_PERMISSIONS = 2;
static final int NUM_PERMISSIONS = 1;

/**
* Asset version number, used to determine stale assets. Increment this number every time the
@@ -183,13 +183,10 @@ public void onCreate( Bundle savedInstanceState )

public void requestPermissions()
{
if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED
|| ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED)
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED)
{

// Should we show an explanation?
if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.READ_EXTERNAL_STORAGE)
|| ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.WRITE_EXTERNAL_STORAGE))
if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.WRITE_EXTERNAL_STORAGE))
{
//Show dialog asking for permissions
new AlertDialog.Builder(this)
@@ -242,7 +239,6 @@ public void onClick(DialogInterface dialog, int which)
public void actuallyRequestPermissions()
{
ActivityCompat.requestPermissions(this, new String[] {
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE }, PERMISSION_REQUEST);
}

0 comments on commit 42012bc

Please sign in to comment.