Android Weekly #503
https://androidweekly.net/issues/issue-503
Your Deep Links Might Be Broken: Web Intents and Android 12
每個(gè)Android版本的發(fā)布都會(huì)帶來(lái)兩種changes:
- API changes: 代碼接口變化, 通常通過(guò)編譯錯(cuò)誤或者lint警告發(fā)現(xiàn).
- Behavior changes: 行為變化, 只能通過(guò)功能使用發(fā)現(xiàn).
Google提供了Behavior changes的文檔: Behavior changes: all apps
Android 12對(duì)deeplink有了這個(gè)改動(dòng):
Starting in Android 12 (API level 31), a generic web intent resolves to an activity in your app only if your app is approved for the specific domain
contained in that web intent. If your app isn't approved for the domain, the web intent resolves to the user's default browser app instead.
這個(gè)改動(dòng)是什么意思呢?
從Android 6開(kāi)始, Google提供了Android App Links, 可以把a(bǔ)pp作為鏈接的默認(rèn)處理方式, Android系統(tǒng)會(huì)直接打開(kāi)這個(gè)app. (需要在自己domain的網(wǎng)站上配置一個(gè)文件, 設(shè)置app的包名和簽名.)
從Android 12開(kāi)始, Google會(huì)要求對(duì)HTTP或HTTPS的鏈接都使用App Links, 否則將永遠(yuǎn)是在瀏覽器打開(kāi).
幾個(gè)實(shí)現(xiàn)關(guān)鍵點(diǎn):
- intent filter中的android:autoVerify="true”.
- assetlinks.json 文件****.****
Animations in Jetpack Compose with examples
Sample: https://github.com/canopas/Jetpack-compose-animations-examples
Learning in public: Lessons from open source
作者開(kāi)源了依賴檢測(cè)插件: https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin
作者講了他的心路歷程.
The Imposter's Guide To Dependency Injection
有Video: https://youtu.be/Nr_njiLsjcM
還發(fā)表在這里: The Imposter's Guide To Dependency Injection
從Firebase的例子開(kāi)始講起, 如果直接用, 會(huì)不可測(cè)試.
由構(gòu)造傳入解決了測(cè)試問(wèn)題之后, 下一個(gè)問(wèn)題是, 如果我想共享依賴的實(shí)例怎么辦.
為了解決這個(gè)問(wèn)題需要做3步:
- 創(chuàng)建一個(gè)container來(lái)持有依賴實(shí)例.
- 讓application作為host.
- 讓各個(gè)screen來(lái)獲取依賴.
不同的依賴注入框架都是離不開(kāi)這基本的三步.
舉例說(shuō)明了Hilt和Koin的例子.
All about Preferences DataStore
data store preference的特點(diǎn)和使用.
Improving App Performance with Baseline Profiles
廣告了一下Baseline Profiles這個(gè)工具: https://developer.android.com/topic/performance/baselineprofiles
鏈接里關(guān)于facebook app啟動(dòng)速度優(yōu)化的文章值得一看: https://android-developers.googleblog.com/2021/11/improving-app-startup-facebook-app.html
Make a monorepo for your Android projects
把所有side project搞個(gè)mono repo, 聽(tīng)上去是個(gè)好主意啊.
文章介紹了一些具體的gradle設(shè)置.
sample: https://github.com/blundell/monorepo
Tracing main thread messages in Perfetto
看主線程在干什么.
Building design system with Jetpack Compose
design system.
有系統(tǒng)的介紹, 相關(guān)資源和Compose相關(guān)的實(shí)現(xiàn).
Kotlin Multiplatform: The Best Choice
多種跨平臺(tái)方案的比較.
有很多圖表.
Code
- https://github.com/GetStream/butterfly 折疊屏, 叫butterfly很形象.
- https://github.com/blundell/monorepo
- https://github.com/haroldadmin/lucilla
- https://github.com/theapache64/stackzy 一個(gè)desktop app, 用來(lái)分析apk, 用compose desktop寫的.