Skip to content

Deeplink with Push notification for Unity 2019.4 (android , iOS) not working #83

@mudassar024

Description

@mudassar024

Braze Unity android deeplink in push notification issue:
Deeplink was working fine in Unity 2018.4.26 with Braze Unity plugin 2.7.1
After updating Unity to 2019.4.22 with Braze Unity plugin 2.8.0, deeplink with push notification is not working.
Receivenig notificaton data and deeplink uri in logs only if app is already open, but not if app is closed.

Braze Unity iOS deeplink in push notification issue:
Deeplink with push notification was not working in Unity 2018.4.26 with Braze 2.7.1
After updating Unity to 2019.4.22 with Braze Unity plugin 2.8.0, deeplink with push notification is working for only those users who already registered there push token.
Here is the detail:
to get device token for Unity 2019.4.22

IEnumerator RequestUninstallToken()
{
    const AuthorizationOption AUTHORIZATION_OPTION = AuthorizationOption.Alert | AuthorizationOption.Badge;
    using (var req = new AuthorizationRequest(AUTHORIZATION_OPTION, true))
    {
        while (!req.IsFinished)
        {
            yield return null;
        }
        if (req.Granted && req.DeviceToken.IsNotNullNorEmpty())
        {
             Appboy.AppboyBinding.RegisterAppboyPushMessages(Encoding.UTF8.GetBytes(req.DeviceToken));
        }
    }
}

Braze says BadDeviceToken when try to send notificaion. so no notification received.

But if we use Obsolete method

NotificationServices.RegisterForNotifications(NotificationType.Alert | NotificationType.Badge | NotificationType.Sound);
Appboy.AppboyBinding.RegisterAppboyPushMessages(UnityEngine.iOS.NotificationServices.deviceToken);

token register successfully and we are receiving push notification, but deeplink is not working in this case..

Next we remove this line
NotificationServices.RegisterForNotifications(NotificationType.Alert | NotificationType.Badge | NotificationType.Sound);
and build , now push notification is working deeplink.. (because braze has device token already)

but how we register device token without calling "NotificationServices.RegisterForNotifications"
Without calling this "NotificationServices.RegisterForNotifications"
NotificationServices.deviceToken return null so we can't register device.

Q1. deeplink with push notification for unity android is not working?
Q2. How do we register correct device token with new Unity version 2019.4.22?
Q3. Why deeplink is not working when "NotificationServices.RegisterForNotifications" is in the code to get device token with obsolete method?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions