1

I need to develop an ANDROID client that will communicate with the server that runs WCF REST services.

Since I have limited experience with this I am looking a solution for:

  • pushing data to android device (the client needs constant updates from the server)
  • calling a method on server (reflection)

Any ideas/hints/samples are most welcome !

no9
  • 6,424
  • 25
  • 76
  • 115

2 Answers2

2

For push notifications, check out Google's C2DM framework (cloud to device messaging). It's available on Android 2.2 and up.

Basically, the phone will maintain an open socket with Google's servers, and when you want to push data to a device, you POST a request to Google from your web app (you'd likely use System.Net.WebRequest from .NET, for example), and they handle the rest.

For more info on setting up things from your Android app, see this tutorial.

wsanville
  • 37,158
  • 8
  • 76
  • 101
  • thanks wsanville. Currently it seems that is the only "proper" way to go. Or notify the server in intervals, but that is messy. – no9 Apr 09 '12 at 17:59
  • I would image Google's setup would be far better than any homegrown solution in this scenario. – wsanville Apr 09 '12 at 18:01
  • 1
    As for C# libraries to help you out, see [this question](http://stackoverflow.com/questions/5714230/c2dm-server-with-c-sharp) or the [C2DM-Sharp Github project](https://github.com/Redth/C2DM-Sharp). – wsanville Apr 09 '12 at 18:02
  • There's a walkthrough at http://www.codeproject.com/Articles/339162/Android-push-notification-implementation-using-ASP – SteveCav Apr 24 '12 at 02:02
  • C2DM is now deprecated. You can do the same with [GCM](http://developer.android.com/guide/google/gcm/index.html) (Google Cloud Messaging) – castle1971 Jul 09 '12 at 08:58
1

WCF doesn't have any push notification API except duplex messaging with callback channel but that is not available for REST services in WCF 4. In WCF any kind of client notification over HTTP is based with polling - you can use Comet like approach with long poll intervals.

In WCF 4.5 you will be able to use WebSockets and callback channel over HTTP but again the support for REST is up to you.

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670