Merge pull request #353 from connyduck/permission-fix

fix permission problem when downloading image
This commit is contained in:
Vavassor 2017-07-18 20:19:51 -04:00 committed by GitHub
commit da663ba67c
2 changed files with 2 additions and 2 deletions

View File

@ -5,7 +5,7 @@
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" /> <!--For notifications--> <uses-permission android:name="android.permission.VIBRATE" /> <!--For notifications-->
<uses-permission android:name="android.permission.WAKE_LOCK" /> <!--Required by Eclipse Paho--> <uses-permission android:name="android.permission.WAKE_LOCK" /> <!--Required by Eclipse Paho-->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!--Required by Eclipse Paho--> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!--Required by Eclipse Paho-->

View File

@ -201,7 +201,7 @@ public class ViewMediaActivity extends BaseActivity implements ViewMediaFragment
} }
private void downloadImage() { private void downloadImage() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN && if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) { != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, ActivityCompat.requestPermissions(this,