Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update packages to use firebase-messaging 23.0.0 #204

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
apply plugin: 'com.android.library'

buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath('com.android.tools.build:gradle:4.1.3')
classpath 'com.google.gms:google-services:4.3.10' // Google Services plugin
}
}

android {
compileSdkVersion 28

defaultConfig {
minSdkVersion 16
minSdkVersion 26
targetSdkVersion 28
versionCode 1
versionName "1.0"
versionName "1.1"
ndk {
abiFilters "armeabi-v7a", "x86"
}
Expand All @@ -23,14 +34,24 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'com.facebook.react:react-native:+'
implementation 'com.google.firebase:firebase-messaging:17.6.0'
implementation 'com.android.support:appcompat-v7:28.0.0'

implementation platform('com.google.firebase:firebase-bom:29.0.0')

// Declare the dependencies for the Firebase Cloud Messaging and Analytics libraries
// When using the BoM, you don't specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.firebase:firebase-analytics'

implementation 'com.google.android.gms:play-services-base:17.6.0'

implementation 'com.android.support:appcompat-v7:28.+'
implementation 'com.microsoft.azure:notification-hubs-android-sdk:0.6@aar'
}

repositories {
maven {
url "http://dl.bintray.com/microsoftazuremobile/SDK"
}
mavenCentral()
}

Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ public void onHostPause() {
public void onHostDestroy() {
}

@Override
public void onNewIntent(Intent intent) {
Bundle bundle = ReactNativeUtil.getBundleFromIntent(intent);
if (bundle != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
import android.content.Context;
import android.content.Intent;

import androidx.annotation.NonNull;
import androidx.core.app.JobIntentService;

import android.util.Log;

import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.InstanceIdResult;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.messaging.FirebaseMessaging;
import com.microsoft.windowsazure.messaging.NotificationHub;

import java.util.concurrent.ExecutorService;
Expand Down Expand Up @@ -49,13 +50,17 @@ protected void onHandleWork(Intent intent) {
return;
}

FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener(
mPool, new OnSuccessListener<InstanceIdResult>() {
FirebaseMessaging.getInstance().getToken().addOnCompleteListener(
mPool, new OnCompleteListener<String>() {
@Override
public void onSuccess(InstanceIdResult instanceIdResult) {
public void onComplete(@NonNull Task<String> task) {
if (!task.isSuccessful()) {
Log.w(TAG, "Fetching FCM registration token failed.", task.getException());
return;
}
try {
String regID = notificationHubUtil.getRegistrationID(ReactNativeRegistrationIntentService.this);
String token = instanceIdResult.getToken();
String token = task.getResult();
Log.d(TAG, "FCM Registration Token: " + token);

// Storing the registration ID indicates whether the generated token has been
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
},
"homepage": "https://github.com/CatalystCode/react-native-azurenotificationhub#readme",
"devDependencies": {
"react": "^15.3.0",
"react-native": "^0.32.0",
"react-native-windows": "^0.32.0"
"react": "17.0.1",
"react-native": "~0.64.3",
"react-native-windows": "~0.64.26"
}
}