File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
src/main/kotlin/com/simplemobiletools/smsmessenger/activities Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ android {
5656}
5757
5858dependencies {
59- implementation ' com.simplemobiletools:commons:5.25.19 '
59+ implementation ' com.simplemobiletools:commons:5.25.21 '
6060 implementation ' androidx.constraintlayout:constraintlayout:2.0.0-beta4'
6161 implementation ' org.greenrobot:eventbus:3.2.0'
6262 implementation ' com.klinkerapps:android-smsmms:5.2.6'
Original file line number Diff line number Diff line change @@ -48,11 +48,16 @@ class MainActivity : SimpleActivity() {
4848
4949 if (isQPlus()) {
5050 val roleManager = getSystemService(RoleManager ::class .java)
51- if (roleManager!! .isRoleHeld(RoleManager .ROLE_SMS )) {
52- askPermissions()
51+ if (roleManager!! .isRoleAvailable(RoleManager .ROLE_SMS )) {
52+ if (roleManager.isRoleHeld(RoleManager .ROLE_SMS )) {
53+ askPermissions()
54+ } else {
55+ val intent = roleManager.createRequestRoleIntent(RoleManager .ROLE_SMS )
56+ startActivityForResult(intent, MAKE_DEFAULT_APP_REQUEST )
57+ }
5358 } else {
54- val intent = roleManager.createRequestRoleIntent( RoleManager . ROLE_SMS )
55- startActivityForResult(intent, MAKE_DEFAULT_APP_REQUEST )
59+ toast( R .string.unknown_error_occurred )
60+ finish( )
5661 }
5762 } else {
5863 if (Telephony .Sms .getDefaultSmsPackage(this ) == packageName) {
You can’t perform that action at this time.
0 commit comments