Skip to content

Commit 34c9bc6

Browse files
authored
Merge pull request #68 from CatalystCode/thcao/fcm-azure-mobile-services
Updating azure mobile services so that it doesn't depend on GCM
2 parents fc8c641 + a3e85a6 commit 34c9bc6

File tree

6 files changed

+8
-5
lines changed

6 files changed

+8
-5
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ In `android/app/src/main/AndroidManifest.xml`
148148

149149
<application ...>
150150
...
151+
<uses-library
152+
android:name="org.apache.http.legacy"
153+
android:required="false" />
154+
151155
<service
152156
android:name="com.azure.reactnative.notificationhub.ReactNativeRegistrationIntentService"
153157
android:exported="false" />

android/build.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,11 @@ android {
2121
}
2222

2323
dependencies {
24-
implementation fileTree(dir: 'libs', include: ['*.jar'])
24+
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
2525
implementation 'com.facebook.react:react-native:+'
26-
implementation 'com.google.android.gms:play-services-gcm:16.1.0'
2726
implementation 'com.google.firebase:firebase-messaging:17.6.0'
2827
implementation 'com.android.support:appcompat-v7:28.0.0'
2928
implementation 'com.microsoft.azure:notification-hubs-android-sdk:0.4@aar'
30-
implementation 'com.microsoft.azure:azure-notifications-handler:1.0.1@aar'
3129
}
3230

3331
repositories {
56.5 KB
Binary file not shown.

android/src/main/java/com/azure/reactnative/notificationhub/ReactNativeNotificationHubModule.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ public void register(ReadableMap config, Promise promise) {
106106

107107
Intent intent = new Intent(reactContext, ReactNativeRegistrationIntentService.class);
108108
reactContext.startService(intent);
109-
NotificationsManager.handleNotifications(reactContext, senderID, ReactNativeNotificationsHandler.class);
110109
}
111110

112111
@ReactMethod

android/src/main/java/com/azure/reactnative/notificationhub/ReactNativeNotificationsHandler.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ private void sendNotification(Bundle bundle) {
274274
}
275275

276276
Notification info = notification.build();
277-
info.defaults |= Notification.DEFAULT_LIGHTS;
278277

279278
if (bundle.containsKey("tag")) {
280279
String tag = bundle.getString("tag");

android/src/main/java/com/azure/reactnative/notificationhub/ReactNativeRegistrationIntentService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.google.android.gms.tasks.OnSuccessListener;
99
import com.google.firebase.iid.FirebaseInstanceId;
1010
import com.google.firebase.iid.InstanceIdResult;
11+
import com.microsoft.windowsazure.notifications.NotificationsManager;
1112
import com.microsoft.windowsazure.messaging.NotificationHub;
1213

1314
import java.util.concurrent.ExecutorService;
@@ -63,6 +64,8 @@ public void onSuccess(InstanceIdResult instanceIdResult) {
6364
notificationHubUtil.setRegistrationID(ReactNativeRegistrationIntentService.this, regID);
6465
notificationHubUtil.setFCMToken(ReactNativeRegistrationIntentService.this, token);
6566

67+
NotificationsManager.handleNotifications(ReactNativeRegistrationIntentService.this, regID, ReactNativeNotificationsHandler.class);
68+
6669
event.putExtra("event", ReactNativeNotificationHubModule.NOTIF_REGISTER_AZURE_HUB_EVENT);
6770
event.putExtra("data", regID);
6871
localBroadcastManager.sendBroadcast(event);

0 commit comments

Comments
 (0)