Is it possible to get androidContext in androidMain?
e
edenman
05/15/2020, 5:55 AM
i do
expect class Resources
and
expect fun Resources.getString(ref: StringRef): CharSequence
, then in androidMain:
Copy code
actual typealias Resources = android.content.res.Resources
actual fun Resources.getString(ref: StringRef): CharSequence {
return getString(ref.resID)
}
r
Rostislav Utrobin
05/15/2020, 6:06 AM
I need an instance of androidContext to create a new LocationManager instance. Like this:
Copy code
context.getSystemService(Context.LOCATION_SERVICE) as LocationManager
u
Ugi
05/15/2020, 7:03 AM
in android target sourceset you'll have the same libraries as if it was pure android, so yes, you can retrieve and use context there