Merge pull request #189 from lbryio/phone-state-permission-fix

request for READ_PHONE_STATE permission after storage permission is granted
This commit is contained in:
Akinwale Ariwodola 2018-06-22 02:27:34 +01:00 committed by GitHub
commit af3baa99b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -69,7 +69,6 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
STORAGE_PERMISSION_REQ_CODE, STORAGE_PERMISSION_REQ_CODE,
"LBRY requires access to your device storage to be able to download files and media.", "LBRY requires access to your device storage to be able to download files and media.",
this); this);
checkPhoneStatePermission(this);
} }
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -112,6 +111,9 @@ public class MainActivity extends Activity implements DefaultHardwareBackBtnHand
switch (requestCode) { switch (requestCode) {
case STORAGE_PERMISSION_REQ_CODE: case STORAGE_PERMISSION_REQ_CODE:
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// Request for the READ_PHONE_STATE permission
checkPhoneStatePermission(this);
if (BuildConfig.DEBUG && !Settings.canDrawOverlays(this)) { if (BuildConfig.DEBUG && !Settings.canDrawOverlays(this)) {
Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
Uri.parse("package:" + getPackageName())); Uri.parse("package:" + getPackageName()));