Skip to content

Commit

Permalink
feat: add video learning event - receiver
Browse files Browse the repository at this point in the history
Refs #155
  • Loading branch information
jo-elimu committed Sep 26, 2024
1 parent 2ac13b9 commit 1b4de73
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@
<action android:name="ai.elimu.intent.action.STORYBOOK_LEARNING_EVENT" />
</intent-filter>
</receiver>
<receiver android:name=".receiver.VideoLearningEventReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="ai.elimu.intent.action.VIDEO_LEARNING_EVENT" />
</intent-filter>
</receiver>
<receiver android:name=".receiver.BootReceiver"
android:exported="true">
<intent-filter>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package ai.elimu.analytics.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import java.util.Calendar;

import ai.elimu.model.v2.enums.analytics.LearningEventType;
import timber.log.Timber;

public class VideoLearningEventReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
Timber.i("onReceive");

String packageName = intent.getStringExtra("packageName");
Timber.i("packageName: \"" + packageName + "\"");

Calendar timestamp = Calendar.getInstance();
Timber.i("timestamp.getTime(): " + timestamp.getTime());

Long videoId = intent.getLongExtra("videoId", 0);
Timber.i("videoId: " + videoId);

String videoTitle = intent.getStringExtra("videoTitle");
Timber.i("videoTitle: \"" + videoTitle + "\"");

String learningEventTypeAsString = intent.getStringExtra("learningEventType");
Timber.i("learningEventTypeAsString: \"" + learningEventTypeAsString + "\"");
LearningEventType learningEventType = LearningEventType.valueOf(learningEventTypeAsString);
Timber.i("learningEventType: " + learningEventType);

// TODO: new VideoLearningEvent()

// TODO: Store in database
}
}

0 comments on commit 1b4de73

Please sign in to comment.