miha-x64
12/10/2019, 9:28 PMappctx
module? Just found it thanks to Analyze APK. For some reason I can't even see it in 'merged manifest' or 'external libraries'.
I understand the motivation but don't want Android to create one more component and and to have one more singleton.louiscad
12/11/2019, 1:34 PMContext
is already a singleton. FYI, iOS has access to everything that Context provides in a static manner as well (it seems it has caused about zero problems so far, more than 10 years in).
Since Android APIs are polluted with the Context
parameter a lot, appCtx
provide being quite handy. You can still disable it through merged manifest tricks, but if somthing relying on it gets into your app, it will blow up unless there's an alternative way to inject the application Context
that is actually a singleton anyways (a subclass of Application
).
Basing your app's architecture on singeltons is most likely a bad idea, but there are a lot of places where using object
or top level `val`s makes sense, and that's why Kotlin makes it easy, and why appctx
leverages it.miha-x64
12/11/2019, 1:48 PMlouiscad
12/11/2019, 2:03 PMInitProvider
?miha-x64
12/11/2019, 2:07 PMlouiscad
12/11/2019, 5:17 PMappCtx
or it's InitProvider
, this is open source code from an open source library. Code that uses it can still be obfuscated, and appCtx
itself will still be obfuscated.miha-x64
12/12/2019, 12:13 PM_
package and have 1..3-char name unless they are entry points (application components).louiscad
12/12/2019, 9:44 PM