Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase event not logging from Android Service

I have a music streaming service in my android app and I was trying to log streamed musics using Fire-base event logging.I implemented everything accordingly and I can see events from my Activities but not from my services.

Am I missing something or doesn't firebase support events from services?

public class Player extends Service implements ...{


public FirebaseAnalytics mFirebaseAnalytics;
@Override
public void onCreate() {
    Player.running = true;
    super.onCreate();

    this.startForeground();
    mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
    ...
}

And Logginng as

Bundle bundle1 = new Bundle();
bundle1.putString(FirebaseAnalytics.Param.VALUE,"song_finished");
mFirebaseAnalytics.logEvent("song_finished", bundle1);
like image 993
ሹሉቃ ሻምባ Avatar asked Nov 25 '16 23:11

ሹሉቃ ሻምባ


2 Answers

As per Firebase documentation, logging of Analytics takes upto 24hours to show up on firebase console. So if you have logged an event, you would have to wait for few hours to show up on the console.

like image 162
Rahul Agrawal Avatar answered Oct 12 '22 11:10

Rahul Agrawal


Firebase does support services. You either need to wait for a day or alternatively you can enable debug mode. Please note that debug mode is only supported in latest Google Play Services release so you will need to use at least version 10.0.0 or later. In debug mode all events are uploaded within seconds or logging the event.

like image 28
djabi Avatar answered Oct 12 '22 11:10

djabi