File tree Expand file tree Collapse file tree
android/src/main/java/com/azure/reactnative/notificationhub Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -110,6 +110,20 @@ public void unregister(Promise promise) {
110110 promise .reject (ERROR_NOTIFICATION_HUB , e );
111111 }
112112 }
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+ }
113127
114128 private static class GoogleApiAvailabilityRunnable implements Runnable {
115129 private final Activity activity ;
You can’t perform that action at this time.
0 commit comments