Closed BeatriceOltean closed 9 years ago
Fixed on Jan 20th (https://github.com/MSOpenTech/msopentech-tools-for-intellij/commit/8cfbd728316a0051ad6c5224c53bf732f48cbdfa)
And merged on Jan 28th (https://github.com/MSOpenTech/msopentech-tools-for-intellij/pull/113)
Notification HUB has the following connection string in AzureServiceactivity.
String hubName = context.getString(R.string.nh_name_activity_azure_services); String connStr = context.getString(R.string.nh_conn_str_activity_azure_services);
Now it has the correct order.
public static class NotificationHubsHelper extends NotificationsHandler {
@Override
public void onRegistered(Context context, String gcmRegistrationId) {
try {
String hubName = context.getString(R.string.nh_name_activity_azure_services);
String connStr = context.getString(R.string.nh_conn_str_activity_azure_services);
NotificationHub hub = new NotificationHub(hubName, connStr, context);
hub.register(gcmRegistrationId);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onUnregistered(Context context, String gcmRegistrationId) {
try {
String hubName = context.getString(R.string.nh_name_activity_azure_services);
String connStr = context.getString(R.string.nh_conn_str_activity_azure_services);
NotificationHub hub = new NotificationHub(hubName, connStr, context);
hub.unregister();
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onReceive(Context context, Bundle bundle) {
super.onReceive(context, bundle);
//YOU CAN OVERRIDE THE DEFAULT IMPLEMENTATION HERE
}
}
Closing this issue since the code was corrected.
The code added to create the NotificationHub object has the connection string and hub name mixed up: String connectionString = "plugintesthub"; return new NotificationHub("Endpoint=sb://plugintesthub-ns.servicebus.windows.net/;SharedAccessKeyName=DefaultListenSharedAccessSignature;SharedAccessKey=/vknTzWL7AIZ2fnI/sLZ5JJvr9C1EdbMwK86HbrCgdo=", connectionString, activity); Notification Hub takes the hub name first and the connection string second. Plus we’re putting the hub name in the connection string variable.