{"id":299,"date":"2015-06-16T09:49:20","date_gmt":"2015-06-16T08:49:20","guid":{"rendered":"https:\/\/mokrzycki.eu\/blog\/?p=299"},"modified":"2018-12-04T15:43:04","modified_gmt":"2018-12-04T14:43:04","slug":"simulating-gcm-notification-from-console","status":"publish","type":"post","link":"https:\/\/mokrzycki.eu\/blog\/2015\/06\/16\/simulating-gcm-notification-from-console\/","title":{"rendered":"Simulating gcm notification from console"},"content":{"rendered":"<p>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.<br \/>\nYou must change also in manifest two things.<br \/>\n1. In gcm receiver You must remove SEND<br \/>\n2. In permission list paste permission to send gcms.<\/p>\n<p>[java]<br \/>\n&lt;receiver<br \/>\nandroid:name=&#8221;com.example.android.gcm.GcmBroadcastReceiver&#8221;<br \/>\nandroid:permission=&#8221;com.google.android.c2dm.permission.SEND&#8221;\/\/&lt;&#8211;REMOVE, COPY TO CLIPBOARD<br \/>\n&gt;<br \/>\n&lt;intent-filter&gt;<br \/>\n&lt;action android:name=&#8221;com.google.android.c2dm.intent.RECEIVE&#8221; \/&gt;<br \/>\n&lt;category android:name=&#8221;${applicationId}&#8221; \/&gt;<br \/>\n&lt;\/intent-filter&gt;<br \/>\n&lt;intent-filter&gt;<br \/>\n&lt;action android:name=&#8221;com.google.android.c2dm.intent.REGISTRATION&#8221; \/&gt;<br \/>\n&lt;category android:name=&#8221;${applicationId}&#8221; \/&gt;<br \/>\n&lt;\/intent-filter&gt;<br \/>\n&lt;\/receiver&gt;<\/p>\n<p>&lt;!&#8211;PERMISSION LIST&#8211;&gt;<br \/>\n&lt;uses-permission android:name=&#8221;android.permission.INTERNET&#8221; \/&gt;<br \/>\n&lt;uses-permission android:name=&#8221;android.permission.WRITE_EXTERNAL_STORAGE&#8221; \/&gt;<br \/>\n&lt;uses-permission android:name=&#8221;android.permission.ACCESS_NETWORK_STATE&#8221; \/&gt;<br \/>\n&lt;uses-permission android:name=&#8221;com.google.android.c2dm.permission.SEND&#8221; \/&gt;\/\/&lt;&#8211;PASTE PERMISSION HERE[\/java]<\/p>\n<p>Below pattern &#8220;how-to&#8221; and example.<\/p>\n<p>PATTERN<br \/>\n[java]\/\/adb shell am broadcast -a &lt;Intent-Name&gt; -n &lt;Package&gt;\/&lt;Receiver-Name-with-leading-dot&gt; &lt;Extras&gt;[\/java]<\/p>\n<p>My app needs some params (&#8211;es is kind of argument [key-value]).<\/p>\n<p>COMMAND<br \/>\n[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 &#8211;es &#8220;key1&#8221; &#8220;abc&#8221; &#8211;es &#8220;key2&#8221; &#8220;def&#8221;[\/java]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post I will show only example of using gcm notification broadcasting from console&#8230;.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[500],"tags":[5,204,115,206,196,207,205],"_links":{"self":[{"href":"https:\/\/mokrzycki.eu\/blog\/wp-json\/wp\/v2\/posts\/299"}],"collection":[{"href":"https:\/\/mokrzycki.eu\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mokrzycki.eu\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mokrzycki.eu\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mokrzycki.eu\/blog\/wp-json\/wp\/v2\/comments?post=299"}],"version-history":[{"count":9,"href":"https:\/\/mokrzycki.eu\/blog\/wp-json\/wp\/v2\/posts\/299\/revisions"}],"predecessor-version":[{"id":723,"href":"https:\/\/mokrzycki.eu\/blog\/wp-json\/wp\/v2\/posts\/299\/revisions\/723"}],"wp:attachment":[{"href":"https:\/\/mokrzycki.eu\/blog\/wp-json\/wp\/v2\/media?parent=299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mokrzycki.eu\/blog\/wp-json\/wp\/v2\/categories?post=299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mokrzycki.eu\/blog\/wp-json\/wp\/v2\/tags?post=299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}