Android Weekly Notes #503 Android Weekly #503

Android Weekly #503

https://androidweekly.net/issues/issue-503

Your Deep Links Might Be Broken: Web Intents and Android 12

每個Android版本的發佈都會帶來兩種changes:

  • API changes: 代碼接口變化, 通常通過編譯錯誤或者lint警告發現.
  • Behavior changes: 行爲變化, 只能通過功能使用發現.

Google提供了Behavior changes的文檔: Behavior changes: all apps

Android 12對deeplink有了這個改動:

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.

這個改動是什麼意思呢?

從Android 6開始, Google提供了Android App Links, 可以把app作爲鏈接的默認處理方式, Android系統會直接打開這個app. (需要在自己domain的網站上配置一個文件, 設置app的包名和簽名.)

從Android 12開始, Google會要求對HTTP或HTTPS的鏈接都使用App Links, 否則將永遠是在瀏覽器打開.

幾個實現關鍵點:

  • 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

作者開源了依賴檢測插件: https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin

作者講了他的心路歷程.

The Imposter's Guide To Dependency Injection

有Video: https://youtu.be/Nr_njiLsjcM

還發表在這裏: The Imposter's Guide To Dependency Injection

從Firebase的例子開始講起, 如果直接用, 會不可測試.

由構造傳入解決了測試問題之後, 下一個問題是, 如果我想共享依賴的實例怎麼辦.

爲了解決這個問題需要做3步:

  • 創建一個container來持有依賴實例.
  • 讓application作爲host.
  • 讓各個screen來獲取依賴.

不同的依賴注入框架都是離不開這基本的三步.

舉例說明了Hilt和Koin的例子.

All about Preferences DataStore

data store preference的特點和使用.

Improving App Performance with Baseline Profiles

廣告了一下Baseline Profiles這個工具: https://developer.android.com/topic/performance/baselineprofiles

鏈接裏關於facebook app啓動速度優化的文章值得一看: https://android-developers.googleblog.com/2021/11/improving-app-startup-facebook-app.html

Make a monorepo for your Android projects

把所有side project搞個mono repo, 聽上去是個好主意啊.

文章介紹了一些具體的gradle設置.

sample: https://github.com/blundell/monorepo

Tracing main thread messages in Perfetto

看主線程在幹什麼.

Building design system with Jetpack Compose

design system.

有系統的介紹, 相關資源和Compose相關的實現.

Kotlin Multiplatform: The Best Choice

多種跨平臺方案的比較.

有很多圖表.

Code

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章