0

Im looking to develop an application on Android and some sort of server/service to run on Windows. The Android app will have a number of buttons displayed on the UI and use sockets to communicate with a laptop running the Windows OS. I have experience developing for Android however I have no experience developing for Windows. I have not started developing the app or server yet as i'm still trying to figure what the best way to develop the server/service would be.

E.g. When a button is pressed on the Android UI, I want to send a message (an int or string doesnt really matter) from the phone to the Windows OS. Depending on the message received i want Windows to create a native notification, like the ones that appear when the battery is low etc.

The server/service running on Windows does not need a GUI and im looking to keep it as lightweight as possible i.e. no need to install any other software to create the notification.

Any good opinions as to which technologies/api I should use to implement the Window's server/service? Again, i dont have any experience developing with the Window's api, however id be willing to learn in order to create the most efficient implementation.

Thanks.

bobbyrne01
  • 6,295
  • 19
  • 80
  • 150

1 Answers1

0

Unfortunately, you will not be able to do this without some sort of GUI. Windows services cannot interact with the desktop any longer (as of Windows XP SP2, I believe), so you'll need a GUI of some kind in order to display the notification.

Here's a link to a tutorial I've written for creating a Windows service using C#. Once you have the service in place, you can add the logic for interfacing with your Android app via sockets. You'll then want to create a Windows application that can interface with the service to receive the notifications. The display of the notification is simplified by using the NotifyIcon component. Interfacing between the application and the service is up to you. Many times, WCF is used, but if you're comfortable with sockets, you could just use a socket on the localhost (127.0.0.1). If WCF is used, take a look at Juval Lowy's Publish-Subscribe framework for WCF. I have found this very simple to use for this kind of functionality.

Community
  • 1
  • 1
Matt Davis
  • 45,297
  • 16
  • 93
  • 124
  • Great, thats just the kind of answer i was looking for! Microsoft seems to have removed the "windows service" template from visual studio express 2010 and theres no option to easily install it .. not making things any easier microsoft. Thanks Matt – bobbyrne01 Jul 21 '11 at 11:16
  • Have a look here for how to have the service install/uninstall itself from the command line without requiring InstallUtil.exe. http://stackoverflow.com/questions/1195478/how-to-make-a-net-windows-service-start-right-after-the-installation/1195621#1195621 – Matt Davis Jul 21 '11 at 15:02