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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
450
Android の静的解析における SARIF ファイルの活用
hkusu
0
5.7k
CI_でライブラリのバージョンの変化をレポートする.pdf
hkusu
0
420
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
600
GitHub Actions でユニットテストの結果をレポートする
hkusu
0
3.9k
Other Decks in Programming
See All in Programming
琵琶湖の水は止められてもNet--HTTPのリトライは止められない / You might be able to stop the water flow of Lake Biwa but you can't stop Net::HTTP retries
luccafort
PRO
0
610
進化を続けるGo toolsの現在地 / The Current State of Ever-Evolving Go Tools
hond0413
0
150
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
210
AI時代、エンジニアはどう育つのか -未経験エンジニアの成長を間近で見て考えたこと-
thasu0123
0
220
言葉の格闘技のススメ~紙とペンと言葉から始める、キャリアの描き方~
progresscicada
2
140
【やさしく解説 設計編・中級 #1】一つの車に、運転手は一人 ~ある倉庫システムの事例から~
panda728
PRO
0
200
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
470
the container ship “Apple Silicon”@WWDC26 Recap -Japan-\(region).swift
shingangan
0
110
JAWS-UG横浜 #102 AWSサ終供養LT会 成仏できない AWS サービスたち 〜本日、三体供養します〜
maroon1st
0
330
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
540
2年かけて Deno に DOMMatrix を実装した話 / How I implemented DOMMatrix in Deno over two years
petamoriken
0
210
Apache Hive: そしてCloud Native Lakehouseへ
okumin
1
210
Featured
See All Featured
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
73
41k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
200
Navigating Weather and Climate Data
rabernat
0
460
Facilitating Awesome Meetings
lara
57
7.1k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
400
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
Building Applications with DynamoDB
mza
96
7.2k
How to Think Like a Performance Engineer
csswizardry
28
2.7k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
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_