CatalystCode / react-native-azurenotificationhub

React Native module to support Azure Notification Hub push notifications on Android, iOS, and Windows.
MIT License
47 stars 75 forks source link

Android Register template is not working #176

Closed nithinyell closed 3 years ago

nithinyell commented 3 years ago

Register template function is not working to receive the push notifications.

Issues and Steps to Reproduce

Replaces this with steps to repro your issue, if applicable.

App using registerTemplate, is not receiving any push notifications.

Expected Behavior

Describe what you expected would happen. Application is receiving push Notifications, if we use register() func, but for registerTemplate()

Link to Code

const template                                        = '{\"data\":{\"message\":\"$(message)\"}}';
const templateName                                    = 'Template Name';

async registerAndroidTemplate() {
    PushNotificationEmitter.addListener(EVENT_AZURE_NOTIFICATION_HUB_REGISTERED, this.onAzureNotificationHubRegistered);
    PushNotificationEmitter.addListener(EVENT_AZURE_NOTIFICATION_HUB_REGISTERED_ERROR, this.onAzureNotificationHubRegistrationError);

    let alias = await AsyncStorage.getItem("userAlias")
    tags.push(alias)
    console.log("***", tags)

    NotificationHub.registerTemplate({
      connectionString,
      hubName,
      tags,
      senderID,
      template,
      templateName,
      channelImportance,
      channelShowBadge,
      channelEnableLights,
      channelEnableVibration
    })
    .then((res) => console.warn(res))
    .catch(reason => console.warn(reason));
  }

Reference Screen

Screen Shot 2020-09-30 at 2 51 57 PM
nithinyell commented 3 years ago

@phongcao Please take a look.

nithinyell commented 3 years ago

We are using register() Decided not to useregisterTemplate()as we do not see any push notifications for it.