diff --git a/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java b/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java index be6318f268fdfb8a2a9b4d520e491337fcae0aff..40156ba3b5249c9caedf69a7f69e3504d77ddde1 100644 --- a/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java +++ b/android/src/main/java/com/evollu/react/fcm/FIRMessagingModule.java @@ -212,12 +212,24 @@ public class FIRMessagingModule extends ReactContextBaseJavaModule implements Li @ReactMethod public void subscribeToTopic(String topic){ - FirebaseMessaging.getInstance().subscribeToTopic(topic); + try { + FirebaseMessaging.getInstance().subscribeToTopic(topic); + promise.resolve(null); + } catch (IOException e) { + e.printStackTrace(); + promise.reject(null,e.getMessage()); + } } @ReactMethod public void unsubscribeFromTopic(String topic){ - FirebaseMessaging.getInstance().unsubscribeFromTopic(topic); + try { + FirebaseMessaging.getInstance().unsubscribeFromTopic(topic); + promise.resolve(null); + } catch (IOException e) { + e.printStackTrace(); + promise.reject(null,e.getMessage()); + } } @ReactMethod