Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Runtime permissions in Android 11
Search
Hiroyuki Kusu
November 27, 2020
Programming
510
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Runtime permissions in Android 11
Yumemi.apk #2 (
https://yumemi.connpass.com/event/191284/
) の資料
Hiroyuki Kusu
November 27, 2020
More Decks by Hiroyuki Kusu
See All by Hiroyuki Kusu
モノレポのプルリクエストに最近、導入したもの
hkusu
2
600
GitHub composite actions
hkusu
2
460
Android の静的解析における SARIF ファイルの活用
hkusu
0
5.7k
CI_でライブラリのバージョンの変化をレポートする.pdf
hkusu
0
430
Maestro を GitHub Actions で動かす 〜Android編〜
hkusu
1
1.8k
Android の CI(GitHub Actions)の改善で、最近やったこと
hkusu
0
740
Tauri Mobile で生成される Android のコードを見てみる
hkusu
0
1.6k
Custom GitHub Actions を作って Organization 内で共有する
hkusu
1
610
GitHub Actions でユニットテストの結果をレポートする
hkusu
0
3.9k
Other Decks in Programming
See All in Programming
Flow は今どうなっているか
mizdra
PRO
0
880
iOS開発×AI駆動開発 〜最近使って便利だったスキルの話〜
nogu66
0
140
DynamoDBの基礎を振り返りながらベクトル検索機能を理解する
musan
3
260
AIに既存システムを理解させる技術 ~レガシーを見捨てないハーネスエンジニアリング入門~
ochtum
0
200
ソフトウェアラスタライザ
fadis
1
780
GraphRAGのKnowledge Graphを 直接!見る/View-GraphRAG's-KnowledgeGraph-directly!
tyumugi1113
0
180
バグを直したら useEffect が消えた
colorful12
3
830
Vibes Containers 〜AIで変わるコンテナ設計と運用〜
tkikuc
1
440
Jindong: Introducing Declarative Haptics in Compose Multiplatform
l2hyunwoo
0
140
型解析で実現する Go の言語内 DSL / Conference に Go! タイムテーブルの歩き方 for Gophers
mazrean
0
120
不幸な GC
chencmd
0
870
AIと壁打ちしながら進めるコスト管理
fufuhu
2
1.9k
Featured
See All Featured
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.7k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
520
Being A Developer After 40
akosma
91
590k
Product Roadmaps are Hard
iamctodd
55
13k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
Skip the Path - Find Your Career Trail
mkilby
1
220
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Making Projects Easy
brettharned
120
6.7k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Git: the NoSQL Database
bkeepers
PRO
432
67k
Transcript
Runtime permissions in Android 11 2020.11.27 YUMEMI.apk #2 Hiroyuki Kusu
( @hkusu_ )
About me
• 1ճ͚ͩͷΞΫηεڐՄΦϓγϣϯ͕ՃʢҐஔใɺϚΠΫɺΧϝϥͷ߹ͷΈʣ • ෳճڋ൱͢Δͱʮࠓޙ֬ೝ͠ͳ͍ʯঢ়ଶͱͳΔ • ݖݶΛࣗಈతʹϦηοτ͢Δઃఆ͕Ճ ΞϓϦͷ targetSdkVersion ʹؔͳ͘ɺAPI Level
30 Ҏ্ͷσόΠεͰ
Ґஔใͷ߹
※ ΞϓϦͷ targetSdkVersion ͕ 30Ҏ্ͷ߹σϑΥϧτͰࣗಈϦηοτ͕ON
ैདྷͲ͓ΓɺػೳΛར༻͢ΔલͰ permission Λ औಘ͢ΔίʔυΛॻ͍͍ͯΕɺͱΓ͋͑ͣେৎͦ͏ɻ
class MainFragment : Fragment(R.layout.main_fragment) { // ... override fun onViewCreated(view:
View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) // FragmentͷੜϑΣʔζͰొ͠ͳ͍ͱΤϥʔʹͳΔͷͰҙ val locationPermission = registerForActivityResult( ActivityResultContracts.RequestPermission() ) { isGranted -> when { // طʹڐՄ͞Ε͍ͯͨ or μΠΞϩά͕දࣔ͞Ε[ΞϓϦͷ༻࣌ͷΈ]·ͨ[ࠓճͷΈ]͕ԡԼ͞Εͨ isGranted -> { // ... } // طʹڋ൱͞Ε͍ͯͨ or μΠΞϩά͕දࣔ͞Ε[ڐՄ͠ͳ͍]͕ԡԼ͞Εͨ else -> { // ... } } } button.setOnClickListener { locationPermission.launch(Manifest.permission.ACCESS_FINE_LOCATION) } ※ ActivityResultContracts androidx.activity ͷ 1.2.0ɺandroidx.fragment ͷ 1.3.0 Ҏ߱Ͱར༻͕Մ ϘλϯΛԡԼͨ͠ΒҐஔใΛར༻ͨ͠ԿΒ͔ͷॲཧΛ࣮ߦ͢Δྫɿ
• ContextCompat.checkSelfPermission() • ݱ࣌Ͱݖݶ͕ڐՄ͞Ε͍ͯΔ͔ • ActivityCompat.shouldShowRequestPermissionRationale() • ʮࠓޙ֬ೝ͠ͳ͍ʯঢ়ଶ͔ • PackageManager#isAutoRevokeWhitelisted()
• ݖݶͷࣗಈϦηοτ͕ONͰ͋Δ͔ • ͨͩ͠৽͍͠APIͳͷͰҎԼͷ߹ͷΈར༻͕Մೳ • compileSdkVersion ͕ 30Ҏ্ • API Level 30Ҏ্ͷσόΠε • Build.VERSION.SDK_INT • σόΠεͷ API Level • 30ະຬैདྷͷpermissionͷ༷ͷ··ͳͷͰUIΛ͚Δ߹ ͨͩ͠ɺϢʔβʹڐՄΛଅ͢ͳΒɺ ͋ͨΓΛར༻ͯ͠ಋઢจݴΛ੍ޚ͠ɺUIΛͨ͠ํ͕Αͦ͞͏ɻ
Thank you ! @hkusu_