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
- https://github.com/GetStream/butterfly 折叠屏, 叫butterfly很形象.
- https://github.com/blundell/monorepo
- https://github.com/haroldadmin/lucilla
- https://github.com/theapache64/stackzy 一个desktop app, 用来分析apk, 用compose desktop写的.
网友评论