79162513

Date: 2024-11-06 12:09:21
Score: 0.5
Natty:
Report link

I found on my way, It is working, but it is right way i don't know!!!


    val activity = context.findActivity() as ComponentActivity

    // Registering the result launcher for intent sender resolution
    val resolutionLauncher = remember {
        activity.activityResultRegistry.register("resolutionLauncher", ActivityResultContracts.StartIntentSenderForResult()) { result: ActivityResult ->
            if (result.resultCode == RESULT_OK) {
                locationViewModel.requestLocationUpdates()
            } else {
                locationViewModel.removeLocationUpdates()
            }
        }
    }
    

And i need to use this launcher to send resolution pending intent,

  resolutionLauncher.launch(IntentSenderRequest.Builder(
                            resolvable.resolution.intentSender).build())
Reasons:
  • Blacklisted phrase (0.5): i need
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Santhosh Kumar