diff --git a/app/build.gradle b/app/build.gradle index 281b0dc..f93c404 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,7 +1,9 @@ plugins { id 'com.android.application' + id 'com.google.firebase.firebase-perf' + id 'com.google.gms.google-services' + id 'com.google.firebase.crashlytics' } - android { compileSdkVersion 30 buildToolsVersion "30.0.3" @@ -30,11 +32,17 @@ android { } dependencies { - + implementation platform('com.google.firebase:firebase-bom:26.1.0') + implementation 'com.google.firebase:firebase-analytics:19.0.0' + implementation 'com.google.firebase:firebase-inappmessaging-display:20.0.0' + implementation 'com.google.firebase:firebase-messaging:22.0.0' + implementation 'com.google.firebase:firebase-crashlytics:18.0.0' + implementation 'com.google.firebase:firebase-analytics' implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'com.google.android.material:material:1.3.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'com.google.android.exoplayer:exoplayer:2.13.3' + implementation 'com.google.firebase:firebase-perf:20.0.0' testImplementation 'junit:junit:4.+' androidTestImplementation 'androidx.test.ext:junit:1.1.2' diff --git a/app/google-services.json b/app/google-services.json new file mode 100644 index 0000000..353ddb3 --- /dev/null +++ b/app/google-services.json @@ -0,0 +1,39 @@ +{ + "project_info": { + "project_number": "1098951021382", + "project_id": "fpvout", + "storage_bucket": "fpvout.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:1098951021382:android:0e42e902c98c2d6deb4b47", + "android_client_info": { + "package_name": "com.fpvout.digiview" + } + }, + "oauth_client": [ + { + "client_id": "1098951021382-lge70n5fif1csdumcuk86omabtgvsems.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyDRfdW_nEkshiKZnlUiTY7Ww5R3Ne0Fgog" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "1098951021382-lge70n5fif1csdumcuk86omabtgvsems.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f5bb3de..dcd51d8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,7 +1,7 @@ - + diff --git a/app/src/main/java/com/fpvout/digiview/logging/CustomLogger.java b/app/src/main/java/com/fpvout/digiview/logging/CustomLogger.java new file mode 100644 index 0000000..a5449d8 --- /dev/null +++ b/app/src/main/java/com/fpvout/digiview/logging/CustomLogger.java @@ -0,0 +1,63 @@ +package com.fpvout.digiview.logging; + +import android.util.Log; + + +import com.google.firebase.crashlytics.FirebaseCrashlytics; + +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; + + +public final class CustomLogger{ + public static final void i(String tag, String message){ + Log.i(tag,message); + sendToCrashlytics(tag,message,null); + } + + public static final void d(String tag, String message){ + Log.d(tag,message); + sendToCrashlytics(tag,message,null); + } + + public static final void d(String tag, String message,Throwable ex){ + Log.d(tag,message,ex); + sendToCrashlytics(tag,message,ex); + } + + public static final void e(String tag, String message){ + Log.e(tag,message); + sendToCrashlytics(tag,message,null); + } + + public static final void e(String tag, String message,Throwable ex){ + Log.e(tag,message,ex); + sendToCrashlytics(tag,message,ex); + } + + public static final void wtf(String tag, String message){ + Log.wtf(tag,message); + sendToCrashlytics(tag,message,null); + } + + public static final void v(String tag, String message){ + Log.v(tag,message); + sendToCrashlytics(tag,message,null); + } + + private static void sendToCrashlytics(String tag, String message, Throwable ex){ + try { + FirebaseCrashlytics.getInstance().log(new Date().getTime() + ": Thread:<" + Thread.currentThread().getName() + "> " + tag + " : " + message); + if (ex != null) { + FirebaseCrashlytics.getInstance().recordException(ex); + } + }catch (Exception ex2){ + try { + FirebaseCrashlytics.getInstance().recordException(ex2); + }catch (Exception ex3){ + //keep the APP from crashing + } + } + } +} diff --git a/app/src/main/res/xml/network_security_config.xml b/app/src/main/res/xml/network_security_config.xml new file mode 100644 index 0000000..3fd128a --- /dev/null +++ b/app/src/main/res/xml/network_security_config.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 92f3684..8d7d4f8 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,20 @@ + // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { - google() jcenter() + maven { + url 'https://maven.google.com/' + name 'Google' + + } + google() } dependencies { classpath "com.android.tools.build:gradle:4.1.3" + classpath 'com.google.gms:google-services:4.3.8' + classpath 'com.google.firebase:perf-plugin:1.3.4' + classpath 'com.google.firebase:firebase-crashlytics-gradle:2.6.1' // NOTE: Do not place your application dependencies here; they belong