Skip to content

Commit f15570f

Browse files
Update firebase dependency (#442)
1 parent 9fd71bd commit f15570f

File tree

6 files changed

+20
-104
lines changed

6 files changed

+20
-104
lines changed

app/build.gradle

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
apply plugin: 'com.android.application'
2+
//Un-comment after adding google-services.json file
3+
//apply plugin: 'com.google.gms.google-services'
24
// apply instbaug APM plugin for capturing network requests
35
apply plugin: 'instabug-apm'
46

57
android {
6-
compileSdkVersion 32
8+
compileSdkVersion 33
79

810
defaultConfig {
911
applicationId "com.example.instabug"
10-
minSdkVersion 15
11-
targetSdkVersion 32
12+
minSdkVersion 19
13+
targetSdkVersion 33
1214
versionCode 1
1315
versionName "1.0"
1416
multiDexEnabled true
@@ -51,8 +53,8 @@ dependencies {
5153
implementation "com.google.android.material:material:$rootProject.ext.material"
5254
implementation "androidx.appcompat:appcompat:$rootProject.ext.androidXAppCompat"
5355

54-
implementation 'com.google.firebase:firebase-core:16.0.0'
55-
implementation 'com.google.firebase:firebase-messaging:17.0.0'
56+
implementation 'com.google.firebase:firebase-core:21.1.1'
57+
implementation 'com.google.firebase:firebase-messaging:23.1.1'
5658

5759
//TODO add the following 2 lines if you exclude io.reactivex from Instabug
5860
//implementation 'io.reactivex:rxjava:1.0.13'

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@
6060
android:name="com.example.instabug.fcm.InstabugInstanceIDListenerService"
6161
android:exported="false">
6262
<intent-filter>
63-
<action android:name="com.google.android.gms.iid.InstanceID" />
63+
<action android:name="com.google.firebase.MESSAGING_EVENT" />
6464
</intent-filter>
6565
</service>
66-
<service android:name="com.example.instabug.fcm.RegistrationIntentService" />
6766
</application>
6867
</manifest>
Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,24 @@
11
package com.example.instabug.fcm;
22

3-
import android.content.Intent;
3+
import androidx.annotation.NonNull;
44

5-
import com.google.firebase.iid.FirebaseInstanceIdService;
5+
import com.google.firebase.messaging.FirebaseMessagingService;
6+
import com.instabug.chat.Replies;
67

78
/**
89
* Created by vezikon on 6/27/16.
910
*/
10-
public class InstabugInstanceIDListenerService extends FirebaseInstanceIdService {
11-
12-
private static final String TAG = "InstabugInstanceIDLS";
11+
public class InstabugInstanceIDListenerService extends FirebaseMessagingService {
1312

1413
/**
15-
* Called if InstanceID token is updated. This may occur if the security of
16-
* the previous token had been compromised. This call is initiated by the
17-
* InstanceID provider.
14+
* Called when a new token for the default Firebase project is generated.
15+
* This is invoked after app install when a token is first generated, and again if the token changes.
16+
*
17+
* @param token – The token used for sending messages to this application instance. This token is the same as the one retrieved by FirebaseMessaging.getToken().
1818
*/
19-
// [START refresh_token]
2019
@Override
21-
public void onTokenRefresh() {
22-
// Fetch updated Instance ID token and notify our app's server of any changes (if applicable).
23-
Intent intent = new Intent(this, RegistrationIntentService.class);
24-
startService(intent);
20+
public void onNewToken(@NonNull String token) {
21+
super.onNewToken(token);
22+
Replies.setPushNotificationRegistrationToken(token);
2523
}
26-
// [END refresh_token]
2724
}

app/src/main/java/com/example/instabug/fcm/RegistrationIntentService.java

Lines changed: 0 additions & 73 deletions
This file was deleted.

app/src/main/java/com/example/instabug/ui/activities/MainActivity.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
import com.example.instabug.BaseActivity;
1414
import com.example.instabug.R;
15-
import com.example.instabug.fcm.RegistrationIntentService;
1615
import com.instabug.bug.BugReporting;
1716
import com.instabug.featuresrequest.FeatureRequests;
1817
import com.instabug.library.Instabug;
@@ -42,20 +41,12 @@ protected void onCreate(Bundle savedInstanceState) {
4241
//Instabug logs
4342
InstabugLog.d("MainActivity - Created");
4443

45-
registerFCM();
46-
4744
Toolbar toolbar = findViewById(R.id.toolbar);
4845
setSupportActionBar(toolbar);
4946

5047
doNetworkRequest();
5148
}
5249

53-
private void registerFCM() {
54-
// Start IntentService to register this application with FCM.
55-
Intent intent = new Intent(this, RegistrationIntentService.class);
56-
startService(intent);
57-
}
58-
5950
public void onShowLiveOnboardingMessageClicked(View view) {
6051
Instabug.showWelcomeMessage(WelcomeMessage.State.LIVE);
6152
}

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ buildscript {
2424
}
2525
dependencies {
2626
classpath 'com.android.tools.build:gradle:4.0.1'
27-
27+
classpath 'com.google.gms:google-services:4.3.2'
2828
classpath "com.instabug.library:instabug-plugin:$rootProject.ext.instabugSDK"
2929

3030
}

0 commit comments

Comments
 (0)