Thread
#multiplatform
    r

    Rostislav Utrobin

    2 years ago
    Is it possible to get androidContext in androidMain?
    e

    edenman

    2 years ago
    i do
    expect class Resources
    and
    expect fun Resources.getString(ref: StringRef): CharSequence
    , then in androidMain:
    actual typealias Resources = android.content.res.Resources
    
    actual fun Resources.getString(ref: StringRef): CharSequence {
      return getString(ref.resID)
    }
    r

    Rostislav Utrobin

    2 years ago
    I need an instance of androidContext to create a new LocationManager instance. Like this:
    context.getSystemService(Context.LOCATION_SERVICE) as LocationManager
    Ugi

    Ugi

    2 years ago
    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