Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

IOS Push Notification Permission Delay

Discussion in 'iOS and tvOS' started by Deleted User, Aug 11, 2018.

  1. Deleted User

    Deleted User

    Guest

    Hello ,
    How can i delay the request permission for the push notification on IOS (keeping in mind im just using FIrebase for just downstream messages no upstream so just a code for request token )?
    I have made researches all are saying i cant delay.
    If i can request a prompt for request permission can i atleast disable the auto request on app start?

    Thanks alot in advance !
     
  2. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    You're in complete control of when you call RegisterForNotifications. I call it after the player has made some progress into the game.
     
  3. Deleted User

    Deleted User

    Guest

    and what about the request on app start can i disable it?
     
  4. andymads

    andymads

    Joined:
    Jun 16, 2011
    Posts:
    1,614
    You're talking about the popup that asks if you want to allow notifications right?

    If you're not calling RegisterForNotifications explicitly then you must have some third-party code that's doing it on startup.
     
  5. Deleted User

    Deleted User

    Guest

    Yes i want to disable the push notification request permission popup on start up (Still searching for a way).

    and request it when i need it ( as you said the RegisterForNotification can prompt the popup when needed)
     
  6. marcinlazo

    marcinlazo

    Joined:
    Mar 21, 2018
    Posts:
    3
    Hello LayalFakih, did you ever solve this issue?

    I just added Firebase Messaging to my project. No matter what I do, even if I strip my all code, on iOS the app asks for push notification permission on start.
    Using this line changes nothing:
    Code (CSharp):
    1. Firebase.Messaging.FirebaseMessaging.TokenRegistrationOnInitEnabled = false;
    In my Xcode pods project, I have this added to my Info.plist as boolean:
    Code (CSharp):
    1. FirebaseMessagingAutoInitEnabled = NO
    Please, can anyone give some info on this topic?
     
  7. androxz7

    androxz7

    Joined:
    Mar 9, 2018
    Posts:
    1
    Did you find any solution to this? Im having the same Issue, I want to ask user later when they have used my game for some time to allow notifications, but firebase keep triggering the popup at start
     
    oskar-szulc likes this.
  8. martinasenovdev

    martinasenovdev

    Joined:
    May 7, 2017
    Posts:
    67
    I have this problem too. Did you guys find a solution?

    This delays the initialization of the identifier token to the FCM backend. It has nothing to do with push notifications.
     
  9. chris_unity559

    chris_unity559

    Joined:
    Mar 26, 2019
    Posts:
    12
    Any updates? 2 years have passed since this discussion and we are wondering the same as we are using FireBase.
     
  10. codebaby2

    codebaby2

    Joined:
    Apr 11, 2021
    Posts:
    6
    I think I've found the solution:
    After you build the project for Xcode
    Open the Info.plist file in the generated iOS project
    There should be a variable in there called UnityNotificationRequestAuthorizationOnAppLaunch which is a Boolean value, by default it is set to 1. Set it to 0 and it should stop asking to show notifications automatically on launch.
    Now you can manually ask for push notification permission when you want within your game.
     
  11. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,638
    Open Project Settings in Unity, find notifications there and you'll have a checkbox in there :)