locked
Create a cross-platform view of choice of tags to send notifications based on them RRS feed

All replies

  • User369979 posted

    https://docs.microsoft.com/fr-fr/azure/notification-hubs/push-notifications-android-specific-devices-firebase-cloud-messaging This documentation uses registerTemplate to add tags:

    hub.registerTemplate(FCM_token,"simpleFCMTemplate", templateBodyFCM,
                            categories.toArray(new String[categories.size()]));
    

    However, this https://docs.microsoft.com/fr-fr/xamarin/xamarin-forms/data-cloud/azure-services/azure-notification-hub#configure-the-android-application-for-notifications demonstrates the same method: // Android https://docs.microsoft.com/en-us/xamarin/xamarin-forms/data-cloud/azure-services/azure-notification-hub#override-firebasemessagingservice-to-handle-messages // iOS https://docs.microsoft.com/en-us/xamarin/xamarin-forms/data-cloud/azure-services/azure-notification-hub#register-with-azure-notification-hub-and-subscribe-to-tags When we received the token on each platform, we could register different tags there. Which part are you stuck in?

    Thursday, June 11, 2020 3:26 AM
  • User391106 posted

    Hello, It is not to create the notification but the step before. All the views of the application that will receive the notification are created in the project common to the two platforms. So I need to create a new view with check boxes according to the tags I have defined. The problem is that the receipt of the notification is managed in each platform (in MyFirebaseMessagingService and MainActivity classes for Android and the iOS AppDelegate class). So I don't know how to recover the table created in the view of the common project in order to receive notifications with tags in each of the applications

    Thursday, June 11, 2020 6:03 AM
  • User369979 posted

    If you want to register the template later, try to store this device token for reuse. Use this to retrieve the token on Android:

    FirebaseInstanceId.Instance.Token
    

    This API has been deprecated but we still could get the token through it. For iOS, try to define a static property in AppDelegate like:

    public static NSData DeviceToken;
    public override void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
    {
        // ...
        DeviceToken = deviceToken;
    }
    

    And then we could retrieve this token through: AppDelegate.DeviceToken. Finally, on your registration page, use dependency service to register tags on each platform.

    Thursday, June 11, 2020 6:40 AM
  • User391106 posted

    Sorry, we no longer had internet in the office, I couldn't answer. Hum, in fact, I think I misunderstood the purpose of the tutorial. If I am not mistaken it is used to send notifications from a mobile application.

    In my case the back-end to create notifications is done in php and you can use tags, that's not the problem.

    From the mobile application I only want to receive notifications of one or more tags depending on those to which he has subscribed. Currently the app receives notification all the time

    It's the part "subscribe to one or more tags" that I don't know how to do. And then the case where the user unchecks a tag and therefore unsubscribes from this notification.

    Thursday, June 11, 2020 1:34 PM
  • User369979 posted

    From the mobile application I only want to receive notifications of one or more tags depending on those to which he has subscribed. Currently the app receives notification all the time Have you tried my approaches to register the tags? It's the part "subscribe to one or more tags" that I don't know how to do. When the user wants to change a new tag, try to use the persisted token to register a new template.

    Friday, June 12, 2020 9:51 AM