5

I am working on an Android App. There will be two types of Users - Admin and the client. I just want to make Admin post some notices in Plain text and then those will be notified to Clients. The question is, What should I use to make transfer of notices from Admin to Client. I read somewhere that it is possible with the help of Google App Engine and Google Cloud Messaging (GCM), but it is very complex to work with Google App Engine. Is there any better option that I can use?

Adesh Atole
  • 766
  • 1
  • 8
  • 22

5 Answers5

2

Google app engine is perfect for your requirement as GCM push notifications need some sort of server. For an alternative you can try to explore Parse SDK also.

Dalvinder Singh
  • 2,129
  • 4
  • 21
  • 20
1

You can use Amazon S3 service. Go here for more information: http://aws.amazon.com/s3/

shaktiman_droid
  • 2,368
  • 1
  • 17
  • 32
  • I don't know where to begin. I haven't done any server side programming yet, would you please guide me where to start. – Adesh Atole Apr 16 '14 at 07:46
1

Google App Engine is very simple if you read the step-by-step guide.

You must install maven: fallow this HOW TO and then read the google's guide and, with some cut and paste in the pom.xml, and 3 classes you'll be able to write some REST web service in 4 hours!

I've done this a few week ago, and the complex thing was generate the O-AUTH id for automatic user authentication! In the end you'll be able also to generate e thin Android client to use your service!

If you know java, all this will be simple!

This is a simple web service with app engine:

@Api(
    name = "helloworld",
    version = "v1",
    scopes = {Constants.EMAIL_SCOPE},
    clientIds = {Constants.WEB_CLIENT_ID, Constants.ANDROID_CLIENT_ID, Constants.API_EXPLORER_CLIENT_ID},
    audiences = {Constants.ANDROID_AUDIENCE}
)
 public class Greetings {
    public static ArrayList<HelloGreeting> greetings = new ArrayList<HelloGreeting>();

    static {
       greetings.add(new HelloGreeting("ciao world!"));
       greetings.add(new HelloGreeting("addio world!"));
    }

    public HelloGreeting getGreeting(@Named("id") Integer id) {
       return greetings.get(id);
    }
}
Manuel Spigolon
  • 11,003
  • 5
  • 50
  • 73
1

I think the best choice you have is indeed Google Cloud Messages. Keep in mind that anything that you implement, will have to be very alike to it, so why reinvent the wheel?

If you don't want to use this, there's a couple of other possibilities that come to my mind (though, as I said, finally they emulate GCM's behavior):

  • Implementing a Socket listening in the client side. This way, you first would need to make sure that each client that connects would need to send you somehow (for instance, a HTTP POST request) some signal and the IP address, because you'll need to know where to connect. This way, you'd need to connect to each of the devices each time you want to send a notice, send the message through that Socket and handle timeouts (for instance, if I try to deliver a message and the connection gets refused for X times, I could considerate it as the client has disconnected).

  • Implementing a centralized 'board'. By this approach, clients would connect to a centralized notice board (a HTTP site, for instance), say polling every 30 seconds, and showing just the new messages. This way you'd need to keep control of the already shown messages and show just the new ones. The disadvantage of this approach is that initially it would need to be accessible to anyone (even if they're not using your app), but you can implement some additional security measures to avoid it (for instance, allow just the clients that have registered sending a HTTP POST to the remote server), otherwise redirect them to an error page or return a 430 Forbidden error.

If you finally want to give a try to GCM (which is easier than you might imagine), I wrote an answer a time ago that summarizes to a step-by-step guide what to do to implement it.

Community
  • 1
  • 1
nKn
  • 13,691
  • 9
  • 45
  • 62
1

If only, your concern is you don't want to indulge yourself to server side programming and still want to receive some string in your application as push notification, you can try and explore this:

http://framework.realtime.co/messaging/#android

Sourab Sharma
  • 2,940
  • 1
  • 25
  • 38