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

Question How to spawn permission request window for push-notifications

Discussion in 'Android' started by evgen_hud, May 17, 2023.

  1. evgen_hud

    evgen_hud

    Joined:
    Apr 26, 2016
    Posts:
    2
    Hi, im trying to integrate push-notifications in our app. We use OneSignal and UnityMobileNotifications package. IOS spawn window with permission request just after checkbox in Mobile Notifications, but i didnt see anything like this for android, i try something like

    UnityEngine.Android.Permission.RequestUserPermission ("android.permission.POST_NOTIFICATIONS", callbacks);


    but it didnt spawn any windows and

    UnityEngine.Android.Permission.HasUserAuthorizedPermission ("android.permission.POST_NOTIFICATIONS")


    always return false. Maybe someone got ideas or already beat this issue?

    update: i also add required lines in manifest
     
    Last edited: May 17, 2023
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,632
  3. evgen_hud

    evgen_hud

    Joined:
    Apr 26, 2016
    Posts:
    2
    Thanks, but info from the link didnt answer why RequestUserPermission for POST_NOTIFICATIONS didnt spawn system dialog-window for user

    But for other permissions function works well
     
  4. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,632
    The phone must be running Android 13 and your app must be targeting API 33. Otherwise the request won't work (if phone is 13, then OS should ask for permission automatically).