Skip to content

Commit

Permalink
Update firebase dependency (#442)
Browse files Browse the repository at this point in the history
  • Loading branch information
IslamMohamady authored Dec 21, 2022
1 parent 9fd71bd commit f15570f
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 104 deletions.
12 changes: 7 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
apply plugin: 'com.android.application'
//Un-comment after adding google-services.json file
//apply plugin: 'com.google.gms.google-services'
// apply instbaug APM plugin for capturing network requests
apply plugin: 'instabug-apm'

android {
compileSdkVersion 32
compileSdkVersion 33

defaultConfig {
applicationId "com.example.instabug"
minSdkVersion 15
targetSdkVersion 32
minSdkVersion 19
targetSdkVersion 33
versionCode 1
versionName "1.0"
multiDexEnabled true
Expand Down Expand Up @@ -51,8 +53,8 @@ dependencies {
implementation "com.google.android.material:material:$rootProject.ext.material"
implementation "androidx.appcompat:appcompat:$rootProject.ext.androidXAppCompat"

implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.google.firebase:firebase-core:21.1.1'
implementation 'com.google.firebase:firebase-messaging:23.1.1'

//TODO add the following 2 lines if you exclude io.reactivex from Instabug
//implementation 'io.reactivex:rxjava:1.0.13'
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@
android:name="com.example.instabug.fcm.InstabugInstanceIDListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID" />
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name="com.example.instabug.fcm.RegistrationIntentService" />
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
package com.example.instabug.fcm;

import android.content.Intent;
import androidx.annotation.NonNull;

import com.google.firebase.iid.FirebaseInstanceIdService;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.instabug.chat.Replies;

/**
* Created by vezikon on 6/27/16.
*/
public class InstabugInstanceIDListenerService extends FirebaseInstanceIdService {

private static final String TAG = "InstabugInstanceIDLS";
public class InstabugInstanceIDListenerService extends FirebaseMessagingService {

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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import com.example.instabug.BaseActivity;
import com.example.instabug.R;
import com.example.instabug.fcm.RegistrationIntentService;
import com.instabug.bug.BugReporting;
import com.instabug.featuresrequest.FeatureRequests;
import com.instabug.library.Instabug;
Expand Down Expand Up @@ -42,20 +41,12 @@ protected void onCreate(Bundle savedInstanceState) {
//Instabug logs
InstabugLog.d("MainActivity - Created");

registerFCM();

Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

doNetworkRequest();
}

private void registerFCM() {
// Start IntentService to register this application with FCM.
Intent intent = new Intent(this, RegistrationIntentService.class);
startService(intent);
}

public void onShowLiveOnboardingMessageClicked(View view) {
Instabug.showWelcomeMessage(WelcomeMessage.State.LIVE);
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'

classpath 'com.google.gms:google-services:4.3.2'
classpath "com.instabug.library:instabug-plugin:$rootProject.ext.instabugSDK"

}
Expand Down

0 comments on commit f15570f

Please sign in to comment.