-
Notifications
You must be signed in to change notification settings - Fork 60
Firebase analytics #53
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
Open
shambler123
wants to merge
4
commits into
dev
Choose a base branch
from
feature/52
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ad9a236
add firebase, crashlytic, performance api , CustomLogger
markussta 586ae45
move google-services.json to correct folder
markussta e0fbbc7
fixed some version errors , added network_security_config.xml and int…
markussta b08f2ee
removed local network_security_config.xml cleartext
markussta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
app/src/main/java/com/fpvout/digiview/logging/CustomLogger.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<network-security-config> | ||
|
||
</network-security-config> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how this is handled in open-source projects but I'd suggest to not publish the
googles-services.json
since somebody knowing these keys can spam firebase with arbitrary events...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good question ... it is bound to the package. So in the store its not really possible, but I must admit apps not installed from the play store can spam into the account (but why should they do it :-D )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After a quick research it turned out to be okay to put the
google-service.json
into the public repository since the keys can be extracted easily from the APK itself. But it is possible to restrict the API access to correctly signed APKs only.Take a look at: https://stackoverflow.com/a/57067722/6843341