In this post I will show only example of using gcm notification broadcasting from console. I assume You have working gcm methods in your project.
You must change also in manifest two things.
1. In gcm receiver You must remove SEND
2. In permission list paste permission to send gcms.

[java]
<receiver
android:name=”com.example.android.gcm.GcmBroadcastReceiver”
android:permission=”com.google.android.c2dm.permission.SEND”//<–REMOVE, COPY TO CLIPBOARD
>
<intent-filter>
<action android:name=”com.google.android.c2dm.intent.RECEIVE” />
<category android:name=”${applicationId}” />
</intent-filter>
<intent-filter>
<action android:name=”com.google.android.c2dm.intent.REGISTRATION” />
<category android:name=”${applicationId}” />
</intent-filter>
</receiver>

<!–PERMISSION LIST–>
<uses-permission android:name=”android.permission.INTERNET” />
<uses-permission android:name=”android.permission.WRITE_EXTERNAL_STORAGE” />
<uses-permission android:name=”android.permission.ACCESS_NETWORK_STATE” />
<uses-permission android:name=”com.google.android.c2dm.permission.SEND” />//<–PASTE PERMISSION HERE[/java]

Below pattern “how-to” and example.

PATTERN
[java]//adb shell am broadcast -a <Intent-Name> -n <Package>/<Receiver-Name-with-leading-dot> <Extras>[/java]

My app needs some params (–es is kind of argument [key-value]).

COMMAND
[java]adb shell am broadcast -a com.google.android.c2dm.intent.RECEIVE -c com.example.android.debug -n com.example.android.google.debug/com.example.android.gcm.GcmBroadcastReceiver –es “key1” “abc” –es “key2” “def”[/java]

sorsare

By sorsare

Leave a Reply

Your email address will not be published. Required fields are marked *




Enter Captcha Here :