0

I'm trying to create a Flutter plugin that asks for user notification permission. Most of the suggestion on this thread Ask permission for push notification suggest to do something like:

private val pushNotificationPermissionLauncher = registerForActivityResult(RequestPermission()) { granted ->
            viewModel.inputs.onTurnOnNotificationsClicked(granted)
        }

But to use registerForActivityResult function, the class must be a subclass of AppCompatActivity as far as I understood, and my plugin implementation is a subclass of FlutterPlugin. The question is, how to use registerForActivityResult in a Flutter Android plugin? Should I create a separate Activity to subclass AppCompatActivity? And if so, how to create that and integrate with the Flutter plugin?

GGirotto
  • 848
  • 2
  • 10
  • 31

0 Answers0