Firebase and Fabric Integration: No detectable Fabric Event in Firebase - android

I have integrated my Firebase and Fabric projects since it's available few days ago.
I have such kind of fabric events tracking configured in my code:
Answers.getInstance().logCustom(new CustomEvent("Entity Click").putCustomAttribute("domain", entity.getDomain()).putCustomAttribute("entity", entity.entityId));
But in my Firebase console under Analytics -> Events and Analytics -> StreamView, I can't seem to see Fabric events get integrated over. All I can see is the normal generic Firebase events:
ad_click
ad_impression
app_clear_data
app_remove
app_update
first_open
os_update
screen_view
session_start
Did I misunderstand something?
UPDATE:
Portion of my build.gradle file:
classpath 'io.fabric.tools:gradle:1.24.4'
compile('com.crashlytics.sdk.android:crashlytics:2.7.1#aar') {
transitive = true;
}
#I did not use firebase-core
compile 'com.google.firebase:firebase-config:11.6.0'
compile 'com.google.firebase:firebase-ads:11.6.0'
compile 'com.google.firebase:firebase-messaging:11.6.0'
UPDATE 2:
In Fabric Console, Tools -> Firebase shows the linking in green:
UPDATE 3:
I'm using the new Firebase UI. Under Spark Plan, did not currently link to Big Query.

I did not really pay attention to my firebase events the past few days. But this morning I integrated my Firebase project over to Google Analytics at https://analytics.google.com in hope to gain some missing features like city/state level real-time location info. Turns out there's nothing new and it's the same info that I can find from Firebase Console. But when I check out the Events tab, I can now see my Fabric events. I then headed back to Firebase Console, and found my fabric events are showing now.
It could be the Analytics triggered the integration, or could have already populated in my Firebase prior to any of this. Either way, it's working for me now. :)

Related

Cannot see Firebase Analytics from built Unity Android project

I am trying to link Firebase Analytics to my Unity application and build to Android. My build works and I am able to initialize Firebase + Firebase Analytics and send events, but I cannot see anything in the Firebase Analytics Dashboard (says 0 users active in the last 30 minutes, no events are logged, etc.)
Here is where I initialize Firebase in my application, following their documentation:
private void InitializeFirebase ()
{
FirebaseApp.CheckAndFixDependenciesAsync()
.ContinueWith(
continuationAction: (Task<DependencyStatus> task) =>
{
DependencyStatus dependencyStatus = task.Result;
if (dependencyStatus == DependencyStatus.Available)
{
_FirebaseApp = FirebaseApp.DefaultInstance;
FirebaseAnalytics.SetAnalyticsCollectionEnabled(enabled: true);
_LoggingManager.Logger?.Info(content: "Firebase App ready");
DisplayAnalyticsInstanceId();
}
else
{
_LoggingManager.Logger?.Error(
content: "Could not resolve all Firebase dependencies: " + dependencyStatus);
// Firebase Unity SDK is not safe to use here.
}
});
}
And here's where I log a sample event:
private void SendCompletedEvent (CompletedEvent playerEvent)
{
_Logger.Warning(content: "Sending event complete event");
DisplayAnalyticsInstanceId();
Firebase.Analytics.FirebaseAnalytics
.LogEvent(name: Firebase.Analytics.FirebaseAnalytics.EventComplete);
}
I build an APK using Unity Cloud Build, and because it doesn't use the latest version of XCode, I have downgraded my Firebase version to 8.1.0. In my adb logs, I see these calls go out (all at their appropriate times):
06-30 16:25:34.195 17977 18038 I Unity : Firebase Analytics API Initializing
06-30 16:25:34.195 17977 18038 I Unity : analytics API Initialized
06-30 16:25:34.410 17977 18216 I Unity : Firebase App ready
06-30 16:27:28.310 17977 18038 W Unity : Sending event complete event
So all of these functions are definitely firing, and from what I can tell nothing is complaining. Occasionally, even before I start the program, I do get these errors in adb logs:
06-27 15:28:14.770 1305 10260 W FA : Failed to retrieve Firebase Instance Id
However, I've also been logging my Firebase instance id using the FirebaseAnalytics.GetAnalyticsInstanceIdAsync() function, and at least in Unity is shows up as a real and constant number. So I'm not sure if this is logging from other processes on my device.
I'm really confused on what I'm doing wrong. I've imported Firebase Analytics into my project with the google-services.json file that Firebase gave me, and my events seem to be firing correctly.
I also tried adding the SHA-1 number of my device to Firebase adnroid settings, using the command keytool -printcert -jarfile <package-name>.apk, which I don't think is necessary because I'm not using sign-in services or app invites. That doesn't seem to be having any effect, either.
Is there anything else I can try? Thanks so much!
OP here, I fixed this by basically starting from scratch-- deleting and then freshly importing my Firebase Library into Unity, deleting the Firebase project in the console and creating a new one, recreating/importing the GoogleService-Info.plist and google-services.json files. Then, using the same code, my android build would trigger 'Active users' in the Firebase Analytics console.
Good luck to anyone dealing with anything similar!

Android FirebaseMessaging - getToken fails for some users

I have the following setup in my grade files:
project:
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
app:
implementation platform('com.google.firebase:firebase-bom:29.0.0')
// When using the BoM, you don't specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-messaging'
After the users logs in, I'm doing
FirebaseMessaging.getInstance().getToken().addOnCompleteListener(task -> {
String refreshToken = task.getResult();
....
}
which is fine for most users, but for some (not only a few) get errors like FIS_AUTH_ERROR, MISSING_INSTANCEID_SERVICE, SERVICE_NOT_AVAILABLE.
I guess (!), MISSING_INSTANCEID_SERVICE is no Google API on the device, SERVICE_NOT_AVAILABLE missing network (?) but I'm not sure at all. And I have absolutely no clue about the FIS_AUTH_ERROR. Is there some documentation about this?
MISSING_INSTANCEID_SERVICE
Tokens can't be generated.
SERVICE_NOT_AVAILABLE
The device cannot read the response, or there was a server error.
FIS_AUTH_ERROR
you need to check the documentation get token and get id methods had changed
I think it has to do with firebase dependencies versions mismatch. Try to import the BoM for the Firebase platform. By using BoM your app will always use compatible versions of the Firebase Android libraries.
dependencies {
// Import the BoM for the Firebase platform
implementation platform('com.google.firebase:firebase-bom:30.0.2')
// .... }
FIS_AUTH_ERROR suggests, that the local installation cannot be authenticated:
Firebase Cloud Messaging uses Firebase installation IDs to target devices for message delivery.
Source: Manage Firebase installations
It's a little difficult, unless having a device available, which would show this issue - or somehow being able to narrow this down - by hardware vendor, Android version or package version - because "some (not only a few)" is relatively meaningless, from a technical perspective.
It could well be, that the SHA1/SHA265 key fingerprint might have been changed (you should know) and "some (not only a few)" might still haven't updated to the latest version of the APK/AAB package, signed with the new signing key. Crashlytics would show the package version. You could add the old SHA1/SHA265 key fingerprint back in, so that their instances could authenticate again.

Full offline option using AWS DataStore and then allow an optional activation for the the cloud sync features in Android

I've started a project using AwsAppsync.
The app is going to be offline first. And we want to offer the option to sync in the cloud as an extra option later if the customer wants it. So, I configured my project like this:
In build.gradle added the following:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
classpath 'com.amplifyframework:amplify-tools-gradle-plugin:0.2.1'
}
}
apply plugin: 'com.amplifyframework.amplifytools'
And added those dependencies:
implementation 'com.amplifyframework:core:0.10.0'
implementation 'com.amplifyframework:aws-api:0.10.0' // If using cloud sync
implementation 'com.amplifyframework:aws-datastore:0.10.0'
And then using the Amplify CLI:
copy
Generate models at any time by executing this Amplify CLI command:
amplify codegen models
After this in the onCreate of the activity:
ModelProvider modelProvider = AmplifyModelProvider.getInstance();
Amplify.addPlugin(AWSDataStorePlugin.forModels(modelProvider));
Amplify.configure(getApplicationContext());
With this i can Query, update and delete the data.
Is this enough for a full offline experience?
Now, based on the documentation, to add online sync feature, I have to do the following:
Using the Amplify CLI:
amplify push
This will create the amplifyconfiguration.json with the sync configuration.
Now, this information seems to be set in build time. So, how can I enable/disable this feature to be used just when I need it? The documentation mention the following:
ModelProvider modelProvider = AmplifyModelProvider.getInstance();
Amplify.addPlugin(AWSDataStorePlugin.forModels(modelProvider));
Amplify.addPlugin(new AWSApiPlugin()); // If using remote model synchronization
Amplify.configure(getApplicationContext());
So, would be adding that "new AWSApiPlugin()" the only thing I need to do to enable/disable this feature? Thanks!
Any tutorial/book good enough to explain this? I've read several documentation(including the official) and I wasn't able to find something about this particular case. It is always with online sync from the get go.
From a high level, yes this is fairly accurate. DataStore doesn't require a backend it will just work as a local DB of sorts that you can use for offline including queries. When you add in a backend with amplify push (this deploys an AppSync API backed by DynamoDB) and connect it with AWSApiPlugin it will begin syncing. The best tutorial is in the docs: https://docs.amplify.aws

firebase Instance ID vs android Instance ID

Play services API suggests that there is something called Instance ID
However, after including the following in Android Studio, I am unable to import InstanceID class
compile "com.google.android.gms:play-services-identity:${googlePlayServicesVersion}"
compile "com.google.android.gms:play-services-auth:${googlePlayServicesVersion}"
Per this SO Post, InstanceID class should work if I include the identity play services library.
Following conversion of google cloud messaging to firebase cloud messaging, I believe, it must have been replaced by Firebase Instance ID as mentioned in the red message here.
Now I am not sure if using Firebase ID should have indeed "replaced" Instance ID.
Or, maybe I am missing some library which includes InstanceID?
Yap,
I had the issue, and finally I realize that InstanceID class is a part of 'com.google.android.gms:play-services-iid' library , so you just have to add this line in your gradle build file:
compile "com.google.android.gms:play-services-iid:${googlePlayServicesVersion}"
Unless this works for me :) ...

Flurry Analytics Integration Errors

After I successfully integrated flurry SDK into the library by using this code in my build.gradle file.
compile 'com.flurry.android:analytics:6.2.0'
I created java Class to integrate my API Key into my code, but I faced this probleme and I have no clue what should I do to successfully integrate it
-cannot resolve symbol FlurryAgent
-cannot resolve symbol flurrylistener
PS: I'm new to Flurry analytics and Android Studio
For now just remove the withListener() line.
It's not necessary to initialize Flurry.
Once you have your integration working, you can go back and set it up if you want, I've found it only to be necessary if you need to send events before Flurry completes initialization.
Flurry is working to get this corrected. Joel Duggan is correct the listener is "only necessary if you need to send events before Flurry completes initialization."
We will be removing this line of code from the basic instructions:
.withListener(flurryListener)
And here is the correct syntax for those who need it:
import com.flurry.android.FlurryAgentListener;
....
FlurryAgent.Builder()
.withLogEnabled(true)
.withListener(new FlurryAgentListener() {
#Override
public void onSessionStarted() {
// Session handling code
}
})
.build(this, 'your_api_key');
I was facing same problem, I have updated gradle and my problem is solved. Use latest gradle as follows,
//Flurry
compile 'com.flurry.android:analytics:7.0.0#aar'
for more reference use this url

Categories

Resources