Mimic GCM messages for faster development

<receiver
android:name=”com.tsuharesu.chat.gcm.GCMBroadcastReceiver”
android:permission=”com.google.android.c2dm.permission.SEND” >
<intent-filter>
<action android:name=”com.google.android.c2dm.intent.RECEIVE”/>
<action android:name=”com.google.android.c2dm.intent.REGISTRATION”/>
<category android:name=”com.tsuharesu.chat”/>
</intent-filter>
</receiver>
android:permission=”com.google.android.c2dm.permission.SEND”
<receiver
android:name=”com.tsuharesu.chat.gcm.GCMBroadcastReceiver”
android:permission=”${gcmPermissionRequired}” >
<intent-filter>
<action android:name=”com.google.android.c2dm.intent.RECEIVE”/>
<action android:name=”com.google.android.c2dm.intent.REGISTRATION”/>
<category android:name=”com.tsuharesu.chat”/>
</intent-filter>
</receiver>
buildTypes {
debug {
manifestPlaceholders = [gcmPermissionRequired: “”] // “” => let the GCM BroadcastReceiver accept Intents from ‘adb shell am broadcast’
}
release {
manifestPlaceholders = [gcmPermissionRequired: “com.google.android.c2dm.permission.SEND”]
}
}
adb shell
am broadcast -a com.google.android.c2dm.intent.RECEIVE -n com.tsuharesu.chat/com.tsuharesu.chat.gcm.GCMBroadcastReceiver —-es ‘data.alert’ ‘foo’
Broadcasting: Intent { act=com.google.android.c2dm.intent.RECEIVE cmp=com.tsuharesu.chat/gcm.GCMBroadcastReceiver (has extras) }
Broadcast completed: result=0
am broadcast -a com.google.android.c2dm.intent.RECEIVE -n com.tsuharesu.chat/com.tsuharesu.chat.gcm.GCMBroadcastReceiver —-es ‘notifications’ ‘[{“user_id”:438,”text”:”hey man”}, {“user_id”:438,”text”:”listen to this music!”}]’

--

--

--

Developer, sometimes writer, sometimes funny

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Top 4 Reasons to adopt JAMstack

Light Following Robot

Python: beyond the basics I

[LeetCode] (Easy) 27. Remove Element

Creating Data Frames And Concatenating Them In Python

How I built a typical Ubuntu Terminal using HTML & CSS

Google BigQuery: Stop Worrying & Do Data Pipelines Like A Boss With Speedy Google Cloud SDK And…

Progressive Web Apps: A Quick and Nifty Guide

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Tsuharesu

Tsuharesu

Developer, sometimes writer, sometimes funny

More from Medium

Tried making bubbles

Build Types and Product Flavor in Android

Security in Android 12 — For Developers

Wireless Debugging — Android Apps