Google Cloud Messaging, Android Simple Tutorial for beginner

Android

Video is ready, Click Here to View ×


Join our facebook Group for more examples : http://www.facebook.com/groups/c2dmdeveloper/
http://www.seriousandroiddeveloper.in/

Download ppt :http://ultraimager.webs.com/Seriousandroiddeveloper/GCM_tutorial.pptx

Download client app:http://ultraimager.webs.com/Seriousandroiddeveloper/C2DM%20example%20and%20sample%20source.rar

Download server code: http://ultraimager.webs.com/Seriousandroiddeveloper/GCMserver.zip

Unable to Create Third Party server?, want to test this technology click…

47 thoughts on “Google Cloud Messaging, Android Simple Tutorial for beginner

  1. Very good lots of work went into your video. I understand what you are saying 100% and I am English, so forget the other people they are just jealous cause you know more than they do. Good Work – Cheers Jonathan

  2. Intent registrationIntent = new Intent("com.google.android.c2dm.intent.REGISTER");

    registrationIntent.putExtra("app", PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(), 0));
    registrationIntent.putExtra("sender", "xxxxxxxxxxxxxxxxx");
    startService(registrationIntent)

    is workinfine with android version up to 4.x but failed in android version Lollypop (5.x) … giving error 'Service Intent must be explicit' HOw Ca I solve this

  3. I was a newbie ! not know if this course will help me or not ! I want just to tell you .. just follow that guy and you will make a great app!
    to encourage you, I made this one :
    https://play.google.com/store/apps/details?id=com.campermasterapp.tankinwars
    Yes ! it takes time ! but it's super easy !

    I encourage you ! so please encourage me by adding a review with 5 stars 🙂
    If you made app too ! and you publish it ! I'm here to encourage you too ..
    Hope that you made a great apps

  4. Tried to use your code with lollipop (API 22). But its failing with message java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.google.android.c2dm.intent.REGISTER (has extras) }

  5. This wasn't a bad tutorial. It is a little bit old but it does a good overview of how the whole system works. And his English is fine, idk what some people in the comments are talking about. Learn to listen.

  6. Thank you for the tutorial sir, it was very helpful.
    Can you tell how to send notifications to a particular android device ,when there is a change in the content of google spreadsheets(using app script).

  7.   int SDK_INT = android.os.Build.VERSION.SDK_INT;
            
            if (SDK_INT>8){
             
            StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
             
            StrictMode.setThreadPolicy(policy); 
             

    Use this code on oncreate for android.os.NetworkOnMainThreadException

  8. If u can't speak English well, u'd better speak ur mother tongue. Its too disturbing to listen to both ur childish,weird pronunciation n poor English.U know a lot but u can't explain in English.

  9. I executed the code and its giving me following error ,Any suggestions plz. The registration ID is not getting created too.
    11-28 22:52:56.414: W/ActivityManager(288): Unable to start service Intent { act=com.google.android.c2dm.intent.REGISTER (has extras) } U=0: not found
    11-28 22:52:59.404: D/ExchangeService(632): !!! EAS ExchangeService, onCreate
    11-28 22:52:59.414: D/ExchangeService(632): !!! EAS ExchangeService, onStartCommand, startingUp = false, running = false
    11-28 22:52:59.424: W/ActivityManager(288): Unable to start service Intent { act=com.android.email.ACCOUNT_INTENT } U=0: not found
    11-28 22:52:59.434: D/ExchangeService(632): !!! Email application not found; stopping self
    11-28 22:52:59.444: D/ExchangeService(632): !!! EAS ExchangeService, onStartCommand, startingUp = true, running = false
    11-28 22:52:59.454: W/ActivityManager(288): Unable to start service Intent { act=com.android.email.ACCOUNT_INTENT } U=0: not found
    11-28 22:52:59.464: E/ActivityThread(632): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d35b28 that was originally bound here
    11-28 22:52:59.464: E/ActivityThread(632): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d35b28 that was originally bound here
    11-28 22:52:59.464: E/ActivityThread(632): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
    11-28 22:52:59.464: E/ActivityThread(632): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
    11-28 22:52:59.464: E/ActivityThread(632): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
    11-28 22:52:59.464: E/ActivityThread(632): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
    11-28 22:52:59.464: E/ActivityThread(632): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
    11-28 22:52:59.464: E/ActivityThread(632): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
    11-28 22:52:59.464: E/ActivityThread(632): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
    11-28 22:52:59.464: E/ActivityThread(632): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
    11-28 22:52:59.464: E/ActivityThread(632): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
    11-28 22:52:59.464: E/ActivityThread(632): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
    11-28 22:52:59.464: E/ActivityThread(632): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
    11-28 22:52:59.464: E/ActivityThread(632): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
    11-28 22:52:59.464: E/ActivityThread(632): at android.os.AsyncTask$2.call(AsyncTask.java:287)
    11-28 22:52:59.464: E/ActivityThread(632): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
    11-28 22:52:59.464: E/ActivityThread(632): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    11-28 22:52:59.464: E/ActivityThread(632): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    11-28 22:52:59.464: E/ActivityThread(632): at java.lang.Thread.run(Thread.java:856)
    11-28 22:52:59.474: E/StrictMode(632): null
    11-28 22:52:59.474: E/StrictMode(632): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d35b28 that was originally bound here
    11-28 22:52:59.474: E/StrictMode(632): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
    11-28 22:52:59.474: E/StrictMode(632): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
    11-28 22:52:59.474: E/StrictMode(632): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
    11-28 22:52:59.474: E/StrictMode(632): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
    11-28 22:52:59.474: E/StrictMode(632): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
    11-28 22:52:59.474: E/StrictMode(632): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
    11-28 22:52:59.474: E/StrictMode(632): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
    11-28 22:52:59.474: E/StrictMode(632): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116)
    11-28 22:52:59.474: E/StrictMode(632): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249)
    11-28 22:52:59.474: E/StrictMode(632): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856)
    11-28 22:52:59.474: E/StrictMode(632): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
    11-28 22:52:59.474: E/StrictMode(632): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
    11-28 22:52:59.474: E/StrictMode(632): at android.os.AsyncTask$2.call(AsyncTask.java:287)
    11-28 22:52:59.474: E/StrictMode(632): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
    11-28 22:52:59.474: E/StrictMode(632): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    11-28 22:52:59.474: E/StrictMode(632): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    11-28 22:52:59.474: E/StrictMode(632): at java.lang.Thread.run(Thread.java:856)
    11-28 22:52:59.474: W/ActivityManager(288): Unbind failed: could not find connection for android.os.BinderProxy@4101bf28
    11-28 22:52:59.494: E/ActivityThread(632): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy

  10. there's an error. help please!.
    10-05 11:49:29.051: E/AndroidRuntime(21090): FATAL EXCEPTION: main
    10-05 11:49:29.051: E/AndroidRuntime(21090): android.os.NetworkOnMainThreadException
    10-05 11:49:29.051: E/AndroidRuntime(21090): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1128)
    10-05 11:49:29.051: E/AndroidRuntime(21090): at java.net.InetAddress.lookupHostByName(InetAddress.java:385)
    10-05 11:49:29.051: E/AndroidRuntime(21090): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
    10-05 11:49:29.051: E/AndroidRuntime(21090): at java.net.InetAddress.getAllByName(InetAddress.java:214)
    10-05 11:49:29.051: E/AndroidRuntime(21090): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:137)
    10-05 11:49:29.051: E/AndroidRuntime(21090): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
    10-05 11:49:29.051: E/AndroidRuntime(21090): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
    10-05 11:49:29.051: E/AndroidRuntime(21090): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:365)
    10-05 11:49:29.051: E/AndroidRuntime(21090): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
    10-05 11:49:29.051: E/AndroidRuntime(21090): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
    10-05 11:49:29.051: E/AndroidRuntime(21090): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
    10-05 11:49:29.051: E/AndroidRuntime(21090): at in.ultraneo.gcmserver.Gcmserver.sendmessage2Device(Gcmserver.java:84)
    10-05 11:49:29.051: E/AndroidRuntime(21090): at in.ultraneo.gcmserver.Gcmserver$1.onClick(Gcmserver.java:44)
    10-05 11:49:29.051: E/AndroidRuntime(21090): at android.view.View.performClick(View.java:4222)
    10-05 11:49:29.051: E/AndroidRuntime(21090): at android.view.View$PerformClick.run(View.java:17620)
    10-05 11:49:29.051: E/AndroidRuntime(21090): at android.os.Handler.handleCallback(Handler.java:800)
    10-05 11:49:29.051: E/AndroidRuntime(21090): at android.os.Handler.dispatchMessage(Handler.java:100)
    10-05 11:49:29.051: E/AndroidRuntime(21090): at android.os.Looper.loop(Looper.java:194)
    10-05 11:49:29.051: E/AndroidRuntime(21090): at android.app.ActivityThread.main(ActivityThread.java:5370)
    10-05 11:49:29.051: E/AndroidRuntime(21090): at java.lang.reflect.Method.invokeNative(Native Method)
    10-05 11:49:29.051: E/AndroidRuntime(21090): at java.lang.reflect.Method.invoke(Method.java:525)
    10-05 11:49:29.051: E/AndroidRuntime(21090): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
    10-05 11:49:29.051: E/AndroidRuntime(21090): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
    10-05 11:49:29.051: E/AndroidRuntime(21090): at dalvik.system.NativeStart.main(Native Method)

Leave a Reply

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