3

I have a Jetpack Compose project were I can access a coroutineContext object only. No context available here.

How can I access or initialize android.content.pm.PackageManager ?

Ralf Wickum
  • 2,850
  • 9
  • 55
  • 103

1 Answers1

2

You can get the context object from ContextAmbient.current, using that you can get the PackageManager

Example:

val context = ContextAmbient.current
val packageManager = context.packageManager
Muthukrishnan Rajendran
  • 11,122
  • 3
  • 31
  • 41