Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
72f80b0
commit 46fc649
Showing
7 changed files
with
69 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
app/src/main/java/com/gun0912/tedpermissiondemo/CoroutineActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.gun0912.tedpermissiondemo | ||
|
||
import android.Manifest | ||
import android.os.Bundle | ||
import android.util.Log | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.lifecycle.lifecycleScope | ||
import com.gun0912.tedpermission.coroutine.TedPermission | ||
import kotlinx.coroutines.launch | ||
|
||
|
||
class CoroutineActivity : AppCompatActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
lifecycleScope.launch { | ||
|
||
val permissionResult = TedPermission.create() | ||
.setRationaleTitle(R.string.rationale_title) | ||
.setRationaleMessage(R.string.rationale_message) | ||
.setDeniedTitle("Permission denied") | ||
.setDeniedMessage( | ||
"If you reject permission,you can not use this service\n\nPlease turn on permissions at [Setting] > [Permission]" | ||
) | ||
.setGotoSettingButtonText("bla bla") | ||
.setPermissions( | ||
Manifest.permission.WRITE_EXTERNAL_STORAGE, | ||
Manifest.permission.ACCESS_FINE_LOCATION | ||
) | ||
.check() | ||
|
||
Log.d("ted", "permissionResult: $permissionResult") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
include ':app', ':tedpermission', ':tedpermission-normal', ':tedpermission-rx2', ':tedpermission-rx3' | ||
include ':app', ':tedpermission', ':tedpermission-normal', ':tedpermission-rx2', ':tedpermission-rx3', ':tedpermission-coroutine' |