Is it possible to get androidContext in androidMai...
# multiplatform
r
Is it possible to get androidContext in androidMain?
e
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
I need an instance of androidContext to create a new LocationManager instance. Like this:
Copy code
context.getSystemService(Context.LOCATION_SERVICE) as LocationManager
u
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