Last active
August 5, 2017 10:46
-
-
Save fuka/10f05b9cfb1c038c3d9be1535d9a5b10 to your computer and use it in GitHub Desktop.
Firebase Cloud Messagingの中身をログに出力する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
<receiver | |
android:name=".FirebaseDataReceiver" | |
android:exported="true" | |
android:permission="com.google.android.c2dm.permission.SEND"> | |
<intent-filter> | |
<action android:name="com.google.android.c2dm.intent.RECEIVE"/> | |
</intent-filter> | |
</receiver> | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.firebase; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.os.Bundle; | |
import android.support.v4.content.WakefulBroadcastReceiver; | |
import android.util.Log; | |
public class FirebaseDataReceiver extends WakefulBroadcastReceiver { | |
private final String TAG = FirebaseDataReceiver.class.getName(); | |
public void onReceive(Context context, Intent intent) { | |
Bundle bundle = intent.getExtras(); | |
for (String key : bundle.keySet()) { | |
Object value = bundle.get(key); | |
String valueString = (value != null) ? value.toString() : "<NULL>"; | |
Log.d(TAG, "KEY: " + key + ", VALUE: " + valueString); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment