This commit is contained in:
chenxi 2023-06-15 21:41:59 +08:00
parent daddedf98f
commit 4f7de1fd76
5 changed files with 118 additions and 72 deletions

View File

@ -8,8 +8,8 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
// classpath 'com.google.gms:google-services:4.3.13'
// classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.1'
classpath 'com.google.gms:google-services:4.3.13'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.1'
}
}

View File

@ -44,9 +44,9 @@ dependencies {
implementation "com.android.billingclient:billing:5.0.0"
// firebase
// implementation 'com.google.firebase:firebase-analytics:21.1.0'
// implementation 'com.google.firebase:firebase-crashlytics:18.2.12'
// implementation 'com.google.firebase:firebase-messaging:23.0.8'
implementation 'com.google.firebase:firebase-analytics:21.1.0'
implementation 'com.google.firebase:firebase-crashlytics:18.2.12'
implementation 'com.google.firebase:firebase-messaging:23.0.8'
// Android Resolver Dependencies Start
implementation 'com.adcolony:sdk:4.8.0' // Assets/IronSource/Editor/ISAdColonyAdapterDependencies.xml:8

View File

@ -0,0 +1,47 @@
{
"project_info": {
"project_number": "1008416471093",
"project_id": "knights-combo",
"storage_bucket": "knights-combo.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:1008416471093:android:121c54160b7045e499d97c",
"android_client_info": {
"package_name": "com.combo.heroes.puzzle.rpg"
}
},
"oauth_client": [
{
"client_id": "1008416471093-e1a8gso0q6mpangmi7lltjilfmqeqp6u.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.combo.heroes.puzzle.rpg",
"certificate_hash": "3d9f0e5ebcb906418204e1a41cd40968a36c71cc"
}
},
{
"client_id": "1008416471093-e47s7u8a7v31ulr2f7e9j1mdm9llepum.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyDtkUzjjkNiAZszdepIDIYss0ioNNbjncA"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "1008416471093-e47s7u8a7v31ulr2f7e9j1mdm9llepum.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}

View File

@ -1,50 +1,50 @@
// package com.juzu.dz.third;
package com.juzu.dz.third;
// import android.util.Log;
// import android.widget.Toast;
import android.util.Log;
import android.widget.Toast;
// import androidx.annotation.NonNull;
// import androidx.core.app.NotificationCompat;
import androidx.annotation.NonNull;
import androidx.core.app.NotificationCompat;
// import com.google.android.gms.tasks.OnCompleteListener;
// import com.google.android.gms.tasks.Task;
// import com.google.firebase.messaging.FirebaseMessaging;
// import com.google.firebase.messaging.FirebaseMessagingService;
// import com.google.firebase.messaging.RemoteMessage;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.messaging.FirebaseMessaging;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
// public class BFFirebaseMessagingService extends FirebaseMessagingService {
public class BFFirebaseMessagingService extends FirebaseMessagingService {
// /**
// * There are two scenarios when onNewToken is called:
// * 1) When a new token is generated on initial app startup
// * 2) Whenever an existing token is changed
// * Under #2, there are three scenarios when the existing token is changed:
// * A) App is restored to a new device
// * B) User uninstalls/reinstalls the app
// * C) User clears app data
// */
/**
* There are two scenarios when onNewToken is called:
* 1) When a new token is generated on initial app startup
* 2) Whenever an existing token is changed
* Under #2, there are three scenarios when the existing token is changed:
* A) App is restored to a new device
* B) User uninstalls/reinstalls the app
* C) User clears app data
*/
// @Override
// public void onMessageReceived(RemoteMessage remoteMessage) {
// Log.d("TAG", "From: " + remoteMessage.getFrom());
// // Check if message contains a data payload.
// if (remoteMessage.getData().size() > 0) {
// Log.d("TAG", "Message data payload: " + remoteMessage.getData());
// }
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.d("TAG", "From: " + remoteMessage.getFrom());
// Check if message contains a data payload.
if (remoteMessage.getData().size() > 0) {
Log.d("TAG", "Message data payload: " + remoteMessage.getData());
}
// // Check if message contains a notification payload.
// if (remoteMessage.getNotification() != null) {
// Log.d("TAG", "Message Notification Body: " + remoteMessage.getNotification().getBody());
// }
// }
// Check if message contains a notification payload.
if (remoteMessage.getNotification() != null) {
Log.d("TAG", "Message Notification Body: " + remoteMessage.getNotification().getBody());
}
}
// @Override
// public void onNewToken(String token) {
// Log.d("", "Refreshed token: " + token);
// sendRegistrationToServer(token);
// }
@Override
public void onNewToken(String token) {
Log.d("", "Refreshed token: " + token);
sendRegistrationToServer(token);
}
// private void sendRegistrationToServer(String token) {
// // TODO: Implement this method to send token to your app server.
// }
// }
private void sendRegistrationToServer(String token) {
// TODO: Implement this method to send token to your app server.
}
}

View File

@ -10,8 +10,8 @@ import androidx.annotation.NonNull;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
// import com.google.firebase.messaging.FirebaseMessaging;
// import com.google.firebase.analytics.FirebaseAnalytics;
//import com.google.firebase.crashlytics.FirebaseCrashlytics;
import com.google.firebase.analytics.FirebaseAnalytics;
// import com.google.firebase.crashlytics.FirebaseCrashlytics;
import com.juzu.dz.message.BFMessage;
import com.unity3d.player.UnityPlayer;
@ -27,12 +27,12 @@ public class GooglePlugin {
private static GoogleBilling mGoogleBilling = null;
// private static GoogleAdmobRewardedVideo mGoogleAdmobRewardedVideo = null;
private static Activity _activity;
// public static FirebaseAnalytics mFirebaseAnalytics;
// private FirebaseCrashlytics mFirebaseCrashlytics;
public static FirebaseAnalytics mFirebaseAnalytics;
// private FirebaseCrashlytics mFirebaseCrashlytics;
public static void init(Activity activity){
_activity = activity;
// mFirebaseAnalytics = FirebaseAnalytics.getInstance(_activity);
mFirebaseAnalytics = FirebaseAnalytics.getInstance(_activity);
}
public static void initLogin()
@ -217,34 +217,34 @@ public class GooglePlugin {
// log event
public static void logEvent(String eventName, String data) throws JSONException {
Log.w("", "logEvent");
// if (mFirebaseAnalytics == null) {
// return;
// }
// JSONObject properties = new JSONObject(data);
// Bundle bundle = new Bundle();
// Iterator iter = properties.keys();
// while (iter.hasNext()) {
// String key = (String) iter.next();
// Object value = properties.get(key);
// setBundleValue(bundle, key, value);
// }
// mFirebaseAnalytics.logEvent(eventName, bundle);
if (mFirebaseAnalytics == null) {
return;
}
JSONObject properties = new JSONObject(data);
Bundle bundle = new Bundle();
Iterator iter = properties.keys();
while (iter.hasNext()) {
String key = (String) iter.next();
Object value = properties.get(key);
setBundleValue(bundle, key, value);
}
mFirebaseAnalytics.logEvent(eventName, bundle);
}
public static void logEventBundle(String eventName, Bundle bundle){
Log.w("", "logEvent");
// if (mFirebaseAnalytics == null) {
// return;
// }
// mFirebaseAnalytics.logEvent(eventName, bundle);
if (mFirebaseAnalytics == null) {
return;
}
mFirebaseAnalytics.logEvent(eventName, bundle);
}
// log crash
public static void logCrash(String key, String stack) {
// this.mFirebaseCrashlytics = FirebaseCrashlytics.getInstance();
// if (this.mFirebaseCrashlytics == null)
// return;
// this.mFirebaseCrashlytics.setCustomKey(key, stack);
// this.mFirebaseCrashlytics = FirebaseCrashlytics.getInstance();
// if (this.mFirebaseCrashlytics == null)
// return;
// this.mFirebaseCrashlytics.setCustomKey(key, stack);
}
// set bundle to type
@ -284,5 +284,4 @@ public class GooglePlugin {
// mGoogleAdmobRewardedVideo.setAdPlacement(placement);
// }
}
}