File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
android/src/main/java/com/azure/reactnative/notificationhub Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,20 @@ public void unregister(Promise promise) {
110
110
promise .reject (ERROR_NOTIFICATION_HUB , e );
111
111
}
112
112
}
113
+
114
+ @ ReactMethod
115
+ public void getRegistrationId (Promise promise ) {
116
+ NotificationHubUtil notificationHubUtil = NotificationHubUtil .getInstance ();
117
+ ReactContext reactContext = getReactApplicationContext ();
118
+ String registrationId = notificationHubUtil .getRegistrationID (reactContext );
119
+
120
+ if (registrationId == null ) {
121
+ promise .reject (ERROR_NOT_REGISTERED , "No registration to Azure Notification Hub." );
122
+ }
123
+ else {
124
+ promise .resolve (registrationId );
125
+ }
126
+ }
113
127
114
128
private static class GoogleApiAvailabilityRunnable implements Runnable {
115
129
private final Activity activity ;
You can’t perform that action at this time.
0 commit comments