Programmer
Programmer

Reputation: 878

How to implementing server for Google Cloud Messaging to send Push notification android studio

I want to implement push notification feature in existing android app.

I am following https://developers.google.com/cloud-messaging/android/client tutorial.

As of now so far so good.

Now to send the push notification we must have to implement client and server.

I found the tutorial https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/GcmEndpoints. I followed it but getting lots of dependency errors in android studio.

Can anybody tell me how to implement server side? Is there any better tutorial for the same? Am I on the right track?

I refered below question on stackoverfolw but not satisfied...

How to create server for GCM project in Android

Android push service, implementing the gcm server side (A PHP server, I don't have PHP knowledge , so would like to implement in JAVA launguage)

http://myandroidpoint.blogspot.in/2013/03/android-google-cloud-messaging-server.html

In short, My client is ready, stuck at implementing server.

Thanks! Any help will be highly appreciated.

Upvotes: 0

Views: 1771

Answers (2)

sdelatorre
sdelatorre

Reputation: 97

I had the same problem.

Respect dependencies : I had two problem and I solved ( google.code:findbugs and annotations)

In the first case I deleted directly the "compile testnespresso" and in the second case I changed the version of appcompat ( i had 24) :

Now it's my build.gradle (app):

 androidTestCompile 'com.android.support.test:runner:0.5'
    androidTestCompile 'com.android.support:support-annotations:23.3.0'
    compile 'com.google.android.gms:play-services-gcm:8.4.0'
    compile 'com.android.support:appcompat-v7:23.3.0

'

After I followed the steps in the links you posted and it works perfectly I have a server and I can send messages....( I deployed appengine )

Upvotes: 0

BNK
BNK

Reputation: 24114

Let's assume you have created a new project at Google Developers Console and taken note of 2 values: Project Number, which will be used as SENDER_ID in a client project; and API server key (created at Credentials), which will be used as API_KEY in a server project.

You can find more about basic server project with my answers at the following questions. In the second link, you will find sample code for a server project in Java:

Adding Google Cloud Messagin (GCM) for Android - Registration process

How to implement a GCM Hello World for Android using Android Studio

Hope this helps!

Upvotes: 4

Related Questions