Firebase DebugView无法接收事件

时间:2017-12-10 14:05:29

标签: android firebase firebase-realtime-database google-analytics adb

您正在尝试使用模拟设备将事件记录到Firebase的调试视图中。

我做了什么:

我首先将命令db shell setprop debug.firebase.analytics.app [my_package_name]放入adb shell。

我将模拟器google服务更新到最新版本。

我将模拟器设置为与当前时间匹配的时间。

这是我用来记录事件的方法:

@Override
public void logEvent(String id, String name, String contentType) {
    Bundle bundle = new Bundle();
    bundle.putString(FirebaseAnalytics.Param.ITEM_ID, id);
    bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, name);
    bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, contentType);
    FirebaseAnalytics.getInstance(this).logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
    Log.i("Firebase", "Event " + "\"" + name + "\"" + " logged");
}

调用事件时,会记录到adb shell:

12-10 14:59:26.581 D/FA      ( 6761): Passing event to registered event handler (FE): select_content, Bundle[{item_name=game_started, content_type=started, item_id=0}]
12-10 14:59:26.585 D/FA      ( 6761): Logging event (FE): select_content, Bundle[{item_name=game_started, firebase_event_origin(_o)=app+gtm, firebase_screen_class(_sc)=AndroidLauncher, firebase_screen_id(_si)=-2601296553456604650, content_type=started, item_id=0}]
12-10 14:59:26.602 V/FA      ( 6761): Connecting to remote service
12-10 14:59:26.610 D/FA      ( 6761): Connected to remote service
12-10 14:59:26.610 V/FA      ( 6761): Processing queued up service tasks: 1
12-10 14:59:26.625 V/FA-SVC  ( 5228): Logging event: origin=app+gtm,name=select_content,params=Bundle[{item_name=game_started, firebase_event_origin(_o)=app+gtm, firebase_screen_class(_sc)=AndroidLauncher, firebase_screen_id(_si)=-2601296553456604650, content_type=started, item_id=0}]
12-10 14:59:26.635 V/FA-SVC  ( 5228): Saving event, name, data size: select_content, 148
12-10 14:59:26.635 V/FA-SVC  ( 5228): Event recorded: Event{appId='com.dungeondweller.game', name='select_content', params=Bundle[{item_name=game_started, firebase_event_origin(_o)=app+gtm, _r=1, firebase_screen_class(_sc)=AndroidLauncher, firebase_screen_id(_si)=-2601296553456604650, _dbg=1, content_type=started, item_id=0}]}
12-10 14:59:26.637 V/FA-SVC  ( 5228): Upload scheduled in approximately ms: 500
12-10 14:59:26.637 V/FA-SVC  ( 5228): Cancelling job. JobID: 812057698
12-10 14:59:26.640 V/FA-SVC  ( 5228): Scheduling upload with DelayedRunnable
12-10 14:59:26.641 V/FA-SVC  ( 5228): Scheduling upload with GcmTaskService
12-10 14:59:26.641 V/FA-SVC  ( 5228): Scheduling task with Gcm. Time500
12-10 14:59:26.648 V/FA-SVC  ( 5228): Background event processing time, ms: 23
12-10 14:59:27.142 V/FA-SVC  ( 5228): Cancelling job. JobID: 812057698
12-10 14:59:27.145 V/FA-SVC  ( 5228): Sending upload intent from DelayedRunnable
12-10 14:59:27.147 V/FA-SVC  ( 5228): Device receiver got: com.google.android.gms.measurement.UPLOAD
12-10 14:59:27.147 V/FA-SVC  ( 5228): Starting wakeful intent.
12-10 14:59:27.150 V/FA-SVC  ( 5228): Device PackageMeasurementTaskService is starting up
12-10 14:59:27.150 V/FA-SVC  ( 5228): Device PackageMeasurementTaskService called. startId, action: 1, com.google.android.gms.measurement.UPLOAD
12-10 14:59:27.163 V/FA-SVC  ( 5228): Saving bundle, size: 470
12-10 14:59:27.172 D/FA-SVC  ( 5228): Uploading events. Elapsed time since last upload attempt (ms): 515
12-10 14:59:27.177 V/FA-SVC  ( 5228): Uploading data. app, uncompressed size, data: com.dungeondweller.game, 527,
12-10 14:59:27.177 V/FA-SVC  ( 5228): batch {
12-10 14:59:27.177 V/FA-SVC  ( 5228):   bundle {
12-10 14:59:27.177 V/FA-SVC  ( 5228):     protocol_version: 1
12-10 14:59:27.177 V/FA-SVC  ( 5228):     platform: android
12-10 14:59:27.177 V/FA-SVC  ( 5228):     gmp_version: 11720
12-10 14:59:27.177 V/FA-SVC  ( 5228):     uploading_gmp_version: 11951
12-10 14:59:27.177 V/FA-SVC  ( 5228):     config_version: 1512870899662286
12-10 14:59:27.177 V/FA-SVC  ( 5228):     gmp_app_id: 1:117949461899:android:307f35f7a30782bc
12-10 14:59:27.177 V/FA-SVC  ( 5228):     app_id: com.dungeondweller.game
12-10 14:59:27.177 V/FA-SVC  ( 5228):     app_version: 1.0
12-10 14:59:27.177 V/FA-SVC  ( 5228):     app_version_major: 1
12-10 14:59:27.177 V/FA-SVC  ( 5228):     firebase_instance_id: cQQncn7I_2Y
12-10 14:59:27.177 V/FA-SVC  ( 5228):     dev_cert_hash: -6318672968202681518
12-10 14:59:27.177 V/FA-SVC  ( 5228):     app_store: manual_install
12-10 14:59:27.177 V/FA-SVC  ( 5228):     upload_timestamp_millis: 1512914367152
12-10 14:59:27.177 V/FA-SVC  ( 5228):     start_timestamp_millis: 1512914366576
12-10 14:59:27.177 V/FA-SVC  ( 5228):     end_timestamp_millis: 1512914366576
12-10 14:59:27.177 V/FA-SVC  ( 5228):     previous_bundle_start_timestamp_millis: 1512914114928
12-10 14:59:27.177 V/FA-SVC  ( 5228):     previous_bundle_end_timestamp_millis: 1512914114928
12-10 14:59:27.177 V/FA-SVC  ( 5228):     app_instance_id: d4d62facb13eeb7755193453d2e9c1f1
12-10 14:59:27.177 V/FA-SVC  ( 5228):     resettable_device_id: ee8daf52-3243-440c-9735-f8d42084c021
12-10 14:59:27.177 V/FA-SVC  ( 5228):     limited_ad_tracking: false
12-10 14:59:27.177 V/FA-SVC  ( 5228):     os_version: 8.1.0
12-10 14:59:27.177 V/FA-SVC  ( 5228):     device_model: Android SDK built for x86
12-10 14:59:27.177 V/FA-SVC  ( 5228):     user_default_language: en-us
12-10 14:59:27.177 V/FA-SVC  ( 5228):     time_zone_offset_minutes: 60
12-10 14:59:27.177 V/FA-SVC  ( 5228):     bundle_sequential_index: 20
12-10 14:59:27.177 V/FA-SVC  ( 5228):     service_upload: true
12-10 14:59:27.177 V/FA-SVC  ( 5228):     user_property {
12-10 14:59:27.177 V/FA-SVC  ( 5228):       set_timestamp_millis: 1512913106342
12-10 14:59:27.177 V/FA-SVC  ( 5228):       name: first_open_time(_fot)
12-10 14:59:27.177 V/FA-SVC  ( 5228):       int_value: 1512914400000
12-10 14:59:27.177 V/FA-SVC  ( 5228):     }
12-10 14:59:27.177 V/FA-SVC  ( 5228):     user_property {
12-10 14:59:27.177 V/FA-SVC  ( 5228):       set_timestamp_millis: 1512913106342
12-10 14:59:27.177 V/FA-SVC  ( 5228):       name: first_open_after_install(_fi)
12-10 14:59:27.177 V/FA-SVC  ( 5228):       int_value: 0
12-10 14:59:27.177 V/FA-SVC  ( 5228):     }
12-10 14:59:27.177 V/FA-SVC  ( 5228):     event {
12-10 14:59:27.177 V/FA-SVC  ( 5228):       name: select_content
12-10 14:59:27.177 V/FA-SVC  ( 5228):       timestamp_millis: 1512914366576
12-10 14:59:27.177 V/FA-SVC  ( 5228):       previous_timestamp_millis: 1512914114928
12-10 14:59:27.177 V/FA-SVC  ( 5228):       param {
12-10 14:59:27.177 V/FA-SVC  ( 5228):         name: item_name
12-10 14:59:27.177 V/FA-SVC  ( 5228):         string_value: game_started
12-10 14:59:27.177 V/FA-SVC  ( 5228):       }
12-10 14:59:27.177 V/FA-SVC  ( 5228):       param {
12-10 14:59:27.177 V/FA-SVC  ( 5228):         name: firebase_event_origin(_o)
12-10 14:59:27.177 V/FA-SVC  ( 5228):         string_value: app+gtm
12-10 14:59:27.177 V/FA-SVC  ( 5228):       }
12-10 14:59:27.177 V/FA-SVC  ( 5228):       param {
12-10 14:59:27.177 V/FA-SVC  ( 5228):         name: _r
12-10 14:59:27.177 V/FA-SVC  ( 5228):         int_value: 1
12-10 14:59:27.177 V/FA-SVC  ( 5228):       }
12-10 14:59:27.177 V/FA-SVC  ( 5228):       param {
12-10 14:59:27.177 V/FA-SVC  ( 5228):         name: firebase_screen_class(_sc)
12-10 14:59:27.177 V/FA-SVC  ( 5228):         string_value: AndroidLauncher
12-10 14:59:27.177 V/FA-SVC  ( 5228):       }
12-10 14:59:27.177 V/FA-SVC  ( 5228):       param {
12-10 14:59:27.177 V/FA-SVC  ( 5228):         name: firebase_screen_id(_si)
12-10 14:59:27.177 V/FA-SVC  ( 5228):         int_value: -2601296553456604650
12-10 14:59:27.177 V/FA-SVC  ( 5228):       }
12-10 14:59:27.177 V/FA-SVC  ( 5228):       param {
12-10 14:59:27.177 V/FA-SVC  ( 5228):         name: _dbg
12-10 14:59:27.177 V/FA-SVC  ( 5228):         int_value: 1
12-10 14:59:27.177 V/FA-SVC  ( 5228):       }
12-10 14:59:27.177 V/FA-SVC  ( 5228):       param {
12-10 14:59:27.177 V/FA-SVC  ( 5228):         name: content_type
12-10 14:59:27.177 V/FA-SVC  ( 5228):         string_value: started
12-10 14:59:27.177 V/FA-SVC  ( 5228):       }
12-10 14:59:27.177 V/FA-SVC  ( 5228):       param {
12-10 14:59:27.177 V/FA-SVC  ( 5228):         name: item_id
12-10 14:59:27.177 V/FA-SVC  ( 5228):         string_value: 0
12-10 14:59:27.177 V/FA-SVC  ( 5228):       }
12-10 14:59:27.177 V/FA-SVC  ( 5228):     }
12-10 14:59:27.177 V/FA-SVC  ( 5228):   }
12-10 14:59:27.177 V/FA-SVC  ( 5228): }
12-10 14:59:27.177 V/FA-SVC  ( 5228): Not stopping services. fetch, network, upload: false, true, false
12-10 14:59:27.180 V/FA-SVC  ( 5228): Uploading data. size: 484
12-10 14:59:27.316 V/FA-SVC  ( 5228): Upload scheduled in approximately ms: 3599998
12-10 14:59:27.316 V/FA-SVC  ( 5228): Cancelling job. JobID: 812057698
12-10 14:59:27.319 V/FA-SVC  ( 5228): Scheduling upload with GcmTaskService
12-10 14:59:27.319 V/FA-SVC  ( 5228): Scheduling task with Gcm. Time3599998
12-10 14:59:27.324 V/FA-SVC  ( 5228): Successful upload. Got network response. code, size: 204, 0
12-10 14:59:27.334 V/FA-SVC  ( 5228): Nothing to upload or uploading impossible
12-10 14:59:27.335 V/FA-SVC  ( 5228): Cancelling job. JobID: 812057698
12-10 14:59:27.339 V/FA-SVC  ( 5228): Stopping uploading service(s)
12-10 14:59:27.342 V/FA-SVC  ( 5228): Device PackageMeasurementTaskService is shutting down
12-10 14:59:27.344 V/FA-SVC  ( 5228): Local AppMeasurementService processed last upload request. StartId: 1
12-10 14:59:27.344 V/FA-SVC  ( 5228): Completed wakeful intent.

在DebugView中它说没有连接的设备,所以问题可能就是这样。但我认为db shell setprop debug.firebase.analytics.app [my_package_name]会将设备连接到firebase?根据日志,该事件成功发布,至少是我如何解释它... 我在这里想念的是什么?

0 个答案:

没有答案