Search code examples
iosxamarin.formspush-notificationxamarin.iosvisual-studio-app-center

Appcenter Push iOS - control when to ask for push permission


I can't seem to control AppCenter when to ask for push permissions. As soon as I'm invoking AppCenter.Start(..., typeof(Push)); it immediately asks for the permission. I also tried to disable Push before invoking Start by Push.SetEnabledAsync(true); but that didn't help. Any idea how can I do that?


Solution

  • The official documentation here, has a section for this question:

    Can I delay showing the Push Notifications permission pop-up until the user click a button or a certain screen?

    Basically, you initialize AppCenter at the start of your app

    AppCenter.Start("{KEY}", typeof(Analytics), typeof(Crashes));
    

    And then after login, you can just call

    AppCenter.Start(typeof(Push));