I have implement firebase analytics in my app, but not show up any event or log in fire base console.
Add bellow code in each fragment in onCreateView() method.
private void addFragmentInFirebaseAnalytics() {
FirebaseAnalytics firebaseAnalytics = FirebaseAnalytics.getInstance(getContext());
FragmentItem fragmentItem = new FragmentItem();
fragmentItem.setFragmentId(Constant.FM_ID_MOIST_AIR);
fragmentItem.setFragmentName(MoistAirActivity.class.getSimpleName());
Bundle bundle = new Bundle();
bundle.putInt(FirebaseAnalytics.Param.ITEM_ID, fragmentItem.getFragmentId());
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, fragmentItem.getFragmentName());
//Logs an app event.
firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
Log.d(TAG,"bundle >>"+bundle);
}
Used dependency is :
compile 'com.google.firebase:firebase-core:9.4.0'
used plugin :
apply plugin: 'com.google.gms.google-services'
Its work fine and show log like this in debug console,
09-14 12:30:42.967 D/FA ( 8821): Logging event (FE): select_content, Bundle
[{_o=app, _ev=item_id, item_name=MoistAirActivity, content_type=Navigation Menu,
_err=4}]
09-14 12:30:42.977 V/FA ( 8821): Using measurement service
09-14 12:30:42.977 V/FA ( 8821): Connecting to remote service
09-14 12:30:43.217 D/FA ( 8821): Connected to remote service
09-14 12:30:43.217 V/FA ( 8821): Processing queued up service tasks: 1
09-14 12:30:43.217 E/FA ( 8821): Task exception on worker thread: java.lang
.IllegalStateException: FirebaseApp with name [DEFAULT] doesn't exist. : com.goo
gle.android.gms.measurement.internal.zzt.zzEd(Unknown Source)
09-14 12:30:48.217 V/FA ( 8821): Inactivity, disconnecting from AppMeasurem
entService
but not show any uploading message in debug console and firebase console after 24 hours,
So, whats wrong here ? please help.
Finally i resolved this problem by replacing tools:node="replace" to tools:node="merge" and add tools:replace="android:label" in menifest file.
Reference : FirebaseApp with name [DEFAULT] doesn't exist
For me this worked:
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
in the AndroidManifest.xml.
I've not specified any tools attribute.
There are a few things that could be going on here. You will see more diagnostic messages if you run:
adb shell setprop log.tag.FA VERBOSE
and if your test device has Google Play Services installed, also run:
adb shell setprop log.tag.FA-SVC VERBOSE
Those commands will display more information in your logcat. Are there any errors from FA or FA-SVC on application startup?
Related
My team is building an Android application which uses MQTT (Mosquito) to connect to a PCBs. We are seeing an issue where once a day (Sometimes more) it'll disconnect and we have to reboot the computer for it to reconnect. Haven't been able to pinpoint the issue but are able to see logs. Any thoughts on this?
2022-03-29 08:11:24.442 1327 1382 W BroadcastQueue: Timeout of broadcast BroadcastRecord{22a1d6f u0 MqttService.pingSender.paho27313692436} - receiver=android.os.BinderProxy#991d308, started 60001ms ago
2022-03-29 08:11:24.443 1327 1382 W BroadcastQueue: Receiver during timeout of BroadcastRecord{22a1d6f u0 MqttService.pingSender.paho27313692436} : BroadcastFilter{4ae74c6 10157/u0 ReceiverList{1937aa1 3293 com.example.deadbolt_frontend/10157/u0 remote:991d308}}
Shortly after it disconnects
2022-03-29 08:14:14.641 3293 3293 I MqttClientImp: Attempting MQTT connection
2022-03-29 08:14:14.643 1327 6371 I am_uid_active: 10054
2022-03-29 08:14:14.845 3293 20643 I payment : \*\*\* permitsImpl keysize: 2048
2022-03-29 08:14:14.845 3293 20644 I payment : \*\*\* permitsImpl keysize: 2048
2022-03-29 08:14:14.846 3293 20643 I payment : getPCIFlag failed.
2022-03-29 08:14:14.846 3293 20644 I payment : getPCIFlag failed.
2022-03-29 08:14:14.846 3293 20643 I payment : RSA minSize: 1024
2022-03-29 08:14:14.846 3293 20644 I payment : RSA minSize: 1024
We tried completing a silent reconnect to no avail.
I am migrating my app from using Google Analytics to Google Analytics for Firebase.
I setup a Firebase project like explained in the tutorial https://firebase.google.com/docs/android/setup. Then I setup Analytics like this: https://firebase.google.com/docs/analytics/android/start/
I enalbed looging using:
adb shell setprop log.tag.FA VERBOSE
adb shell setprop log.tag.FA-SVC VERBOSE
adb logcat -v time -s FA FA-SVC
And with the following command I am trying to see the events in the DebugView (https://support.google.com/firebase/answer/7201382?hl=en&utm_id=ad&authuser=0):
adb shell setprop debug.firebase.analytics.app com.myapp.mypackage
All builds and compile but when I run the app in the device and I see the following logs:
09-17 20:32:48.248 21705-21751/com.myapp.mypackage I/FirebaseInitProvider: FirebaseApp initialization successful
09-17 20:32:48.318 21705-21751/com.myapp.mypackage I/FA: App measurement is starting up, version: 18202
09-17 20:32:48.318 21705-21751/com.myapp.mypackage I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
09-17 20:32:48.318 21705-21751/com.myapp.mypackage I/FA: Faster debug mode event logging enabled. To disable, run:
adb shell setprop debug.firebase.analytics.app .none.
09-17 20:32:48.328 21705-21751/com.myapp.mypackage D/FA: Debug-level message logging enabled
09-17 20:32:48.548 21705-21763/com.myapp.mypackage I/dalvikvm: Could not find method android.content.pm.PackageManager.getPackageInstaller, referenced from method com.google.android.gms.common.GooglePlayServicesUtilLight.isUninstalledAppPossiblyUpdating
09-17 20:32:48.568 21705-21763/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date. Requires 12451000 but found 4325038
09-17 20:32:48.648 21705-21751/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date. Requires 12451000 but found 4325038
09-17 20:32:48.658 21705-21705/com.myapp.mypackage D/AppFirebaseAnalytics: setUserProperty: upKey: BuildType -> upValue: debug
09-17 20:32:48.668 21705-21705/com.myapp.mypackage D/AppFirebaseAnalytics: setUserProperty: upKey: AppAnalyticsVersion -> upValue: 2.0
09-17 20:32:48.788 21705-21751/com.myapp.mypackage D/FA: Setting user property (FE): BuildType, debug
09-17 20:32:49.018 21705-21751/com.myapp.mypackage D/FA: Setting user property (FE): AppAnalyticsVersion, 2.0
09-17 20:32:49.668 21705-21705/com.myapp.mypackage W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
09-17 20:32:49.678 21705-21751/com.myapp.mypackage E/FA: Discarding data. Failed to send app launch
09-17 20:32:49.688 21705-21751/com.myapp.mypackage E/FA: Failed to get app instance id
09-17 20:32:49.688 21705-21751/com.myapp.mypackage E/FA: Discarding data. Failed to set user attribute
09-17 20:32:49.688 21705-21751/com.myapp.mypackage E/FA: Discarding data. Failed to set user attribute
09-17 20:32:49.688 21705-21751/com.myapp.mypackage E/FA: Discarding data. Failed to set user attribute
09-17 20:32:49.878 21705-21751/com.myapp.mypackage I/FA: Tag Manager is not found and thus will not be used
09-17 20:32:50.138 21705-21751/com.myapp.mypackage D/FA: Logging event (FE): screen_view(_vs), Bundle[{ga_event_origin(_o)=auto, ga_screen_class(_sc)=AppBootActivity, ga_screen_id(_si)=3005854567277075178}]
09-17 20:32:50.288 21705-21751/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date. Requires 12451000 but found 4325038
09-17 20:32:50.288 21705-21705/com.myapp.mypackage W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
09-17 20:32:50.298 21705-21751/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date. Requires 12451000 but found 4325038
09-17 20:32:50.308 21705-21705/com.myapp.mypackage W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
09-17 20:32:50.318 21705-21751/com.myapp.mypackage E/FA: Discarding data. Failed to send event to service
09-17 20:32:50.318 21705-21751/com.myapp.mypackage E/FA: Failed to send current screen to service
09-17 20:32:50.318 21705-21751/com.myapp.mypackage E/FA: Failed to send current screen to service
09-17 20:32:54.668 21705-21751/com.myapp.mypackage D/FA: Logging event (FE): screen_view(_vs), Bundle[{ga_event_origin(_o)=auto, ga_previous_class(_pc)=AppBootActivity, ga_previous_id(_pi)=3005854567277075178, ga_screen_class(_sc)=ScreenLauncherActivity, ga_screen_id(_si)=3005854567277075179}]
09-17 20:32:54.768 21705-21751/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date. Requires 12451000 but found 4325038
09-17 20:32:56.948 21705-21705/com.myapp.mypackage W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
09-17 20:32:56.958 21705-21751/com.myapp.mypackage E/FA: Discarding data. Failed to send event to service
09-17 20:32:56.958 21705-21751/com.myapp.mypackage E/FA: Failed to send current screen to service
09-17 20:32:56.968 21705-21751/com.myapp.mypackage E/FA: Failed to send current screen to service
09-17 20:33:19.048 21705-21751/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date. Requires 12451000 but found 4325038
09-17 20:33:19.138 21705-21705/com.myapp.mypackage W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
09-17 20:33:19.148 21705-21751/com.myapp.mypackage E/FA: Failed to send current screen to service
09-17 20:33:22.708 21705-21705/com.myapp.mypackage D/AppFirebaseAnalytics: logEvent: eventName: Screen_Launcher -> infoBundle: Bundle[{action=Expand, label=temperatures}]
09-17 20:33:22.768 21705-21751/com.myapp.mypackage D/FA: Logging event (FE): Screen_Launcher, Bundle[{action=Expand, ga_event_origin(_o)=app, ga_screen_class(_sc)=ScreenLauncherActivity, ga_screen_id(_si)=3005854567277075179, label=temperatures}]
09-17 20:33:22.818 21705-21751/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date. Requires 12451000 but found 4325038
09-17 20:33:22.908 21705-21705/com.myapp.mypackage W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
09-17 20:33:22.918 21705-21751/com.myapp.mypackage E/FA: Discarding data. Failed to send event to service
09-17 20:38:22.738 21705-23662/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date. Requires 12451000 but found 4325038
09-17 20:38:22.778 21705-23662/com.myapp.mypackage D/FA: Logging event (FE): user_engagement(_e), Bundle[{ga_event_origin(_o)=auto, engagement_time_msec(_et)=303709, ga_screen_class(_sc)=ScreenLauncherActivity, ga_screen_id(_si)=3005854567277075179}]
09-17 20:38:22.798 21705-21705/com.myapp.mypackage W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
09-17 20:38:23.118 21705-23662/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date. Requires 12451000 but found 4325038
09-17 20:38:23.128 21705-23662/com.myapp.mypackage E/FA: Failed to send current screen to service
09-17 20:38:23.128 21705-23662/com.myapp.mypackage E/FA: Discarding data. Failed to send event to service
09-17 20:38:23.158 21705-23662/com.myapp.mypackage D/FA: Logging event (FE): screen_view(_vs), Bundle[{ga_event_origin(_o)=auto, ga_previous_class(_pc)=ScreenLauncherActivity, ga_previous_id(_pi)=3005854567277075179, ga_screen_class(_sc)=ScreenSaverActivity, ga_screen_id(_si)=3005854567277075180}]
09-17 20:38:23.178 21705-21705/com.myapp.mypackage W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
09-17 20:38:23.208 21705-23662/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date. Requires 12451000 but found 4325038
09-17 20:38:23.218 21705-23662/com.myapp.mypackage E/FA: Discarding data. Failed to send event to service
09-17 20:38:23.218 21705-23662/com.myapp.mypackage E/FA: Failed to send current screen to service
09-17 20:38:23.258 21705-21705/com.myapp.mypackage W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
09-17 20:39:08.618 21705-21705/com.myapp.mypackage D/AppFirebaseAnalytics: logEvent: eventName: Standby -> infoBundle: Bundle[{action=Click, label=Standby}]
09-17 20:39:08.668 21705-23896/com.myapp.mypackage D/FA: Logging event (FE): Standby, Bundle[{action=Click, ga_event_origin(_o)=app, ga_screen_class(_sc)=ScreenSaverActivity, ga_screen_id(_si)=3005854567277075180, label=Standby}]
09-17 20:39:08.728 21705-23896/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date. Requires 12451000 but found 4325038
09-17 20:39:08.808 21705-23896/com.myapp.mypackage D/FA: Logging event (FE): screen_view(_vs), Bundle[{ga_event_origin(_o)=auto, ga_previous_class(_pc)=ScreenSaverActivity, ga_previous_id(_pi)=3005854567277075180, ga_screen_class(_sc)=ScreenLauncherActivity, ga_screen_id(_si)=3005854567277075179}]
09-17 20:39:08.848 21705-21705/com.myapp.mypackage W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
09-17 20:39:08.878 21705-23896/com.myapp.mypackage W/GooglePlayServicesUtil: Google Play services out of date. Requires 12451000 but found 4325038
09-17 20:39:08.898 21705-23896/com.myapp.mypackage D/FA: Logging event (FE): user_engagement(_e), Bundle[{ga_event_origin(_o)=auto, engagement_time_msec(_et)=45904, ga_screen_class(_sc)=ScreenSaverActivity, ga_screen_id(_si)=3005854567277075180}]
09-17 20:39:08.948 21705-23896/com.myapp.mypackage E/FA: Discarding data. Failed to send event to service
09-17 20:39:08.948 21705-23896/com.myapp.mypackage E/FA: Failed to send current screen to service
09-17 20:39:08.948 21705-23896/com.myapp.mypackage E/FA: Discarding data. Failed to send event to service
09-17 20:39:08.948 21705-23896/com.myapp.mypackage E/FA: Failed to send current screen to service
09-17 20:39:08.948 21705-23896/com.myapp.mypackage E/FA: Discarding data. Failed to send event to service
09-17 20:39:09.178 21705-21705/com.myapp.mypackage W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
And there are no events in the DebugView of the Firebase console.
Each time I perform an action to log an event, it complains about Google Play Services.
The devices where the app runs is not deployed into the Play Store so it may have Google Play Services outdated, or even non-existent, and we don't want to force our users to update/install it.
From the logs, it seems FirebaseApp initialization is successful, but then the is a log saying Failed to get app instance id...
I did some research and in some cases I see that Firebase Analytics require Google Play Services updated (https://stackoverflow.com/a/37426991/1204249) but in some others, it looks it should work:
https://blog.novoda.com/firebase-on-amazon-devices/
https://github.com/firebase/quickstart-unity/issues/223#issuecomment-520908309
My questions are:
can I use Firebase Analytics without Google Play services or with an outdated version?
if yes, what could be the problem? Some configuration?
I ended up making it work, but not sure which of the following changes did the trick.
Changes made:
In Firebase console, in Project settings > General, I added the SHA certificate fingerprint, which wasn't there before:
Downloaded the new google-services.json, replaced it in the project and added the following keys in "services":
Removed <meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" /> form the AndroidManifest.xml
Also, even having the previous points in as described, sometimes I could get these errors on my development device... After spending some time on it, I erased the application data from the system settings and it start sending the events again.
I am trying to add firebase cloud messaging to my project. The problem is that I would like to push up notifications when the device is sleeping or the application is in background. Firebase documentation says, that when you send notification when app is not in the foreground, system will do the job but why it works on API 26 and not on API 25 lower?
Notifications in foreground app are handled by me and it works fine, my targeted API is 26 - compiled SDK 26.0.2 and using the newest version of FCM pkg.
My testing devices are adbs with API 19,22,25,26
and Xperia X with API 25, Samsung S8 API 26
My notification JSON that I send:
{
"to" : "existing key",
"condition" : null,
"collapse_key" : null,
"priority" : "high",
"content_available" : null,
"time_to_live" : 3600,
"restricted_package_name" : null,
"dry_run" : null,
"data" : null,
"registration_ids" : null,
"notification" : {
"title" : "ViLo Testzor",
"body" : "Alarm. ",
"sound" : null,
"icon" : null,
"tag" : null,
"color" : null,
"badge" : null,
"bodyLocKey" : null,
"bodyLockArgs" : null,
"clickAction" : null,
"titleLocKey" : null,
"titleLocArgs" : null
}
}
My manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="cz.pkg.app">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:name=".android.App"
android:allowBackup="true"
android:debuggable="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:minSdkVersion="19"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppFullScreenTheme">
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="#drawable/ic_app_icon" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel"
android:value="#string/default_notification_channel_id" />
<activity
android:name=".android.ActivityMain"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="#style/AppFullScreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".android.SenzasenFirebaseInstanceIdService"
android:enabled="true">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<service android:name=".android.SenzasenMessagingService"
android:enabled="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service
android:name=".android.BackgroundWatcher"
android:enabled="true"
android:exported="true" />
<receiver
android:name=".android.notifications.BroadcastRecieverUpdater"
android:enabled="true"
android:exported="true"></receiver>
</application>
</manifest>
My gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "cz.pkg.app"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:26.0.0-alpha1'
compile 'com.google.android.gms:play-services-maps:11.4.2'
compile 'com.google.firebase:firebase-core:11.4.2'
compile 'com.google.firebase:firebase-messaging:11.4.2'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
This is log cat Firebase when notification is send:
10-05 12:25:04.444 5568-5568/? I/FA: App measurement is starting up, version: 11400
10-05 12:25:04.444 5568-5568/? I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
10-05 12:25:04.450 5568-5568/? V/FA: Collection enabled
10-05 12:25:04.450 5568-5568/? V/FA: App package, google app id: cz.pkg.app, 1:535056224042:android:2977b77751aa5b1f
10-05 12:25:04.451 5568-5568/? I/FA: To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app cz.pkg.app
10-05 12:25:04.451 5568-5568/? D/FA: Debug-level message logging enabled
10-05 12:25:04.455 5568-5568/? V/FA: Cancelling job. JobID: 717907879
10-05 12:25:04.456 5568-5568/? V/FA: Registered activity lifecycle callback
10-05 12:25:04.464 5568-5590/? V/FA: Using measurement service
10-05 12:25:04.464 5568-5590/? V/FA: Connecting to remote service
10-05 12:25:04.471 5568-5590/? V/FA: Using measurement service
10-05 12:25:04.471 5568-5590/? V/FA: Connection attempt already in progress
10-05 12:25:04.475 5568-5568/? V/FA: onActivityCreated
10-05 12:25:04.527 5568-5590/cz.pkg.app V/FA: Using measurement service
10-05 12:25:04.527 5568-5590/cz.pkg.app V/FA: Connection attempt already in progress
10-05 12:25:04.529 5568-5590/cz.pkg.app V/FA: Activity resumed, time: 57001950
10-05 12:25:04.533 5568-5590/cz.pkg.app I/FA: Tag Manager is not found and thus will not be used
10-05 12:25:04.534 5568-5590/cz.pkg.app D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_screen_class(_sc)=ActivityMain, firebase_screen_id(_si)=2278851524854650625}]
10-05 12:25:04.547 5568-5590/cz.pkg.app V/FA: Using measurement service
10-05 12:25:04.547 5568-5590/cz.pkg.app V/FA: Connection attempt already in progress
10-05 12:25:04.599 5568-5590/cz.pkg.app D/FA: Connected to remote service
10-05 12:25:04.599 5568-5590/cz.pkg.app V/FA: Processing queued up service tasks: 4
10-05 12:25:04.618 7477-5602/? V/FA-SVC: Logging event: origin=auto,name=screen_view(_vs),params=Bundle[{firebase_event_origin(_o)=auto, firebase_screen_class(_sc)=ActivityMain, firebase_screen_id(_si)=2278851524854650625}]
10-05 12:25:04.621 7477-5602/? V/FA-SVC: Saving event, name, data size: screen_view(_vs), 57
10-05 12:25:04.622 7477-5602/? V/FA-SVC: Event recorded: Event{appId='cz.pkg.app', name='screen_view(_vs)', params=Bundle[{firebase_event_origin(_o)=auto, firebase_screen_class(_sc)=ActivityMain, firebase_screen_id(_si)=2278851524854650625}]}
10-05 12:25:04.623 7477-5602/? V/FA-SVC: Upload scheduled in approximately ms: 1458892
10-05 12:25:04.625 7477-5602/? V/FA-SVC: Cancelling job. JobID: 812057698
10-05 12:25:04.625 7477-5602/? V/FA-SVC: Scheduling upload with AlarmManager
10-05 12:25:04.626 7477-5602/? V/FA-SVC: Background event processing time, ms: 8
10-05 12:25:08.146 5568-5590/cz.pkg.app V/FA: Recording user engagement, ms: 3619
10-05 12:25:08.148 5568-5590/cz.pkg.app V/FA: Activity paused, time: 57005569
10-05 12:25:08.152 5568-5590/cz.pkg.app D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=3619, firebase_screen_class(_sc)=ActivityMain, firebase_screen_id(_si)=2278851524854650625}]
10-05 12:25:08.205 7477-5602/? V/FA-SVC: Logging event: origin=auto,name=user_engagement(_e),params=Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=3619, firebase_screen_class(_sc)=ActivityMain, firebase_screen_id(_si)=2278851524854650625}]
10-05 12:25:08.210 7477-5602/? V/FA-SVC: Saving event, name, data size: user_engagement(_e), 67
10-05 12:25:08.210 7477-5602/? V/FA-SVC: Event recorded: Event{appId='cz.pkg.app', name='user_engagement(_e)', params=Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=3619, firebase_screen_class(_sc)=ActivityMain, firebase_screen_id(_si)=2278851524854650625}]}
10-05 12:25:08.212 7477-5602/? V/FA-SVC: Upload scheduled in approximately ms: 1455303
10-05 12:25:08.213 7477-5602/? V/FA-SVC: Cancelling job. JobID: 812057698
10-05 12:25:08.214 7477-5602/? V/FA-SVC: Scheduling upload with AlarmManager
10-05 12:25:08.214 7477-5602/? V/FA-SVC: Background event processing time, ms: 9
10-05 12:25:15.012 5707-5707/? I/FA: App measurement is starting up, version: 11400
10-05 12:25:15.012 5707-5707/? I/FA: To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
10-05 12:25:15.022 5707-5707/? V/FA: Collection enabled
10-05 12:25:15.022 5707-5707/? V/FA: App package, google app id: cz.pkg.app, 1:535056224042:android:2977b77751aa5b1f
10-05 12:25:15.024 5707-5707/? I/FA: To enable faster debug mode event logging run:
adb shell setprop debug.firebase.analytics.app cz.pkg.app
10-05 12:25:15.024 5707-5707/? D/FA: Debug-level message logging enabled
10-05 12:25:15.033 5707-5707/? V/FA: Cancelling job. JobID: 717907879
10-05 12:25:15.039 5707-5707/? V/FA: Registered activity lifecycle callback
10-05 12:25:15.059 5707-5726/? V/FA: Using measurement service
10-05 12:25:15.061 5707-5726/? V/FA: Connecting to remote service
10-05 12:25:15.074 5707-5726/? V/FA: Using measurement service
10-05 12:25:15.074 5707-5726/? V/FA: Connection attempt already in progress
10-05 12:25:15.078 5707-5726/? D/FA: Connected to remote service
10-05 12:25:15.079 5707-5726/? V/FA: Processing queued up service tasks: 2
10-05 12:25:20.114 5707-5726/cz.pkg.app V/FA: Inactivity, disconnecting from the service
thank you very much for every response Radek.
In your case, Firebase will not call onMessageReceived() if your app is in the background or it is in the killed state.
To get the notification in the background or in the killed state, make the use of data object instead of notification object.
Below will work:
{
"to" : "existing key",
"condition" : null,
"collapse_key" : null,
"priority" : "high",
"content_available" : null,
"time_to_live" : 3600,
"restricted_package_name" : null,
"dry_run" : null,
"data" : {
"title" : "ViLo Testzor",
"body" : "Alarm. ",
"sound" : null,
"icon" : null,
"tag" : null,
"color" : null,
"badge" : null,
"bodyLocKey" : null,
"bodyLockArgs" : null,
"clickAction" : null,
"titleLocKey" : null,
"titleLocArgs" : null
},
"registration_ids" : null,
"notification" :null
}
Add below in Manifest File
<receiver
android:name=".OnBootBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
Create OnBootBroadcastReceiver Class, and call the Firebase service.
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class OnBootBroadcastReceiver extends BroadcastReceiver {
#Override
public void onReceive(Context context, Intent intent) {
Intent i = new Intent("Com.example.SenzasenMessagingService");
i.setClass(context, SenzasenMessagingService.class);
context.startService(i);
}
}
I am trying to integrate Firebase analytics and Google tag manager into my Android app. I have configured some tags and triggers over my GTM console. But i see the following error in my debug console in Android studio. What i am trying to achieve is send my events to both Firebase analytics, GTM and then push the same event to Google analytics using Google tag manager. My events are successfully pushed to Firebase analytics, but not to Google analytics.
Firebase event tracking:
Bundle params = new Bundle();
params.putString("screen_name", "Main activity");
mFirebaseAnalytics.logEvent("screenview", params);
Debug log:
04-06 21:27:19.701 14388-23135/com.droidowl.googletagmanager V/FA: Activity resumed, time: 1495667
04-06 21:27:21.098 14388-23135/com.droidowl.googletagmanager D/FA: Passing event to registered event handler (FE): screenview, Bundle[{screen_name=Main activity}]
04-06 21:27:21.103 14388-14829/com.droidowl.googletagmanager D/FA: Fetching user attributes (FE)
04-06 21:27:21.109 14388-23135/com.droidowl.googletagmanager V/FA: Using measurement service
04-06 21:27:21.109 14388-23135/com.droidowl.googletagmanager V/FA: Connecting to remote service
04-06 21:27:21.157 14388-23135/com.droidowl.googletagmanager D/FA: Connected to remote service
04-06 21:27:21.158 14388-23135/com.droidowl.googletagmanager V/FA: Processing queued up service tasks: 1
04-06 21:27:21.170 14388-14829/com.droidowl.googletagmanager W/GoogleTagManager: No user property available for "item_id" and no default value was defined. Returning "undefined".
04-06 21:27:21.174 14388-14829/com.droidowl.googletagmanager W/GoogleTagManager: No user property available for "item_id" and no default value was defined. Returning "undefined".
04-06 21:27:21.179 14388-23135/com.droidowl.googletagmanager D/FA: Logging event (FE): screenview, Bundle[{screen_name=Main activity, _o=app+gtm}]
04-06 21:27:26.190 14388-23135/com.droidowl.googletagmanager V/FA: Inactivity, disconnecting from AppMeasurementService
Play services version: 9.4.0
The app I am developing is linked to a project in Firebase Console. I have included 'google-services.json' under the 'app' folder too.
My Top Level build.gradle is:
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.google.gms:google-services:3.0.0'
}
My App Level build.gradle is:
dependencies {
compile 'com.google.firebase:firebase-crash:9.8.0'
}
apply plugin: 'com.google.gms.google-services'
I know that latest 'firebase-crash' is 10.0.1 which requires an updated Google Repository and Google Play Services. However, I am able to use same firebase-crash on another app I am making. I am a little short on internet pack, i can't update yet.
I use following snippet in onCreate() of MainActivity to cause a test crash:
FirebaseCrash.log(TAG + ": Test Log"));
FirebaseCrash.report(new Exception("Test Exception"));
I checked 'google-services.json' too for correct mobile_sdk_id, it matches perfectly. My package name matches with firebase project too.
I don't do anything with Firebase Analytics.
Following is logcat output:
20:09:07.830 D/OpenGLRenderer: Enabling debug mode 0
20:09:07.915 D/FA: Connected to remote service
20:09:07.915 V/FA: Processing queued up service tasks: 3
20:09:10.340 D/dalvikvm: GC_CONCURRENT freed 301K, 12% free 11312K/12807K, paused 45ms+3ms, total 167ms
20:09:12.995 V/FA: Inactivity, disconnecting from the service
20:13:29.480 V/FA: Recording user engagement, ms: 261701
20:13:29.480 V/FA: Using measurement service
20:13:29.480 V/FA: Connecting to remote service
20:13:29.485 V/FA: Activity paused, time: 31073604
20:13:29.485 D/FA: Logging event (FE): _e, Bundle[{_o=auto, _si=-207754800234984953, _et=261701, _sc=MainActivity}]
20:13:29.675 D/dalvikvm: GC_CONCURRENT freed 612K, 14% free 11339K/13127K, paused 31ms+64ms, total 187ms
20:13:29.675 V/FA: Using measurement service
20:13:29.690 V/FA: Connection attempt already in progress
20:13:29.690 D/FA: Connected to remote service
20:13:29.695 V/FA: Processing queued up service tasks: 2
20:13:34.745 V/FA: Inactivity, disconnecting from the service
20:26:19.835 D/dalvikvm: GC_CONCURRENT freed 630K, 14% free 11302K/13127K, paused 19ms+2ms, total 135ms
Its been 5 hours since i am trying to see Errors on Firebase Console. I have tried opening and closing my app for more than 20 times.
How do i know FirebaseCrash has been enabled?
When will Errors show up in console?
Am i doing something wrong?
Edit:
There is no V/FirebaseCrash: message in logcat.
Following does not appear in logcat:
FirebaseCrash.logcat(0, TAG, "Test Logcat 0");
FirebaseCrash.logcat(1, TAG, "Test Logcat 1");
There are some lines printed by FirebaseCrash before debugger has attached:
12-11 22:27:09.950 I/FirebaseCrash: FirebaseCrash reporting initialized com.google.android.gms.internal.zzbks#424d3e68
12-11 22:27:09.950 I/FirebaseInitProvider: FirebaseApp initialization successful
Updated Firebase-Crash to 10.0.1 and other SDK tools. No change.
I am so ashamed to know that my laptop's date was one day late. As soon as i corrected the date, results started to show in console. My problem is solved now.