Tutorial :Using data from Google Maps in a C# Program for Windows Mobile



Question:

I'm making a charity Windows Mobile 6 app in C# to help those affected by Alzheimer's.

The aim is for this app to let the carer set a boundary by tapping in Google maps to set points. The carer would then put the windows mobile device in the patient's hand bag or coat, so that when the patient walks out on their own, thinking that they are "going home", the carer receives an SMS text with their position, heading and speed.

However, I don't know how to...

  1. Switch from app to google maps for mobile
  2. tap to select points
  3. import the coordinates of that point to my C# program
  4. use the coordinates to Calculate the boundary
  5. Send the text with the position information
  6. Switch back to my C# program

HTC's HD2 comes with a compass that uses this "tap to select a point then return to app" functionality, so surely it's possible for us too?

If anyone would be able to give me a hand my out I would be EXTREMELY grateful as this will help all those affected by Alzheimer's and other similar conditions. My Gran, for example, recently started trying to walk back to the property she lived in 20 years ago...

Thanks everyone! This means sooo much! I'll even come and buy you a drink to say thanks!

James


Solution:1

Whatever technical issues you're considering, I think you should realize that this type of usage is, AFAICS, contrary to the terms of service of google maps. See:

http://code.google.com/apis/maps/terms.html

That is, you may only use the google maps content if its accessible for everybody, not just whomever you hand out your program to:

Your Maps API Implementation must be generally accessible to users without charge.

If you're building it as a web app, it must be accessible through the internet, not intranet:

[your Maps API Implementation must not:] operate only behind a firewall or only on an internal network (except during the development and testing phase).

Some of the terms in header 10 also seem applicable:

[you must not (nor may you permit anyone else to):] 10.8 use the Static Maps API other than in an implementation in a web browser; 10.9 use the Service or Content with any products, systems, or applications for or in connection with: (a) real time navigation or route guidance, including but not limited to turn-by-turn route guidance that is synchronized to the position of a user's sensor-enabled device;


Solution:2

Why would you want to kludge something together like that? Trying to have your app interface with another application for which you don't have source, whether it's Google Maps fopr Mobile or anything else, is difficult and should only be used as a last resort.

If this app is going to be free and not require users to log in, you can use the Bing Maps Web Service API directly from your application without cost. You could then use built-in GPS through the GPSID APIs as well, and you'd have control over what data goes where, what maps to draw, etc.

This seems like a much easier path to achieve what you're after.

As a side note, I gave a link above for the GPSID sample from Microsoft. I'd recommend looking at it and the native GPSID APIs but the managed wrapper Microsoft provided is, IMO, pure garbage, so you might consider wrapping the lower APIs yourself.


Solution:3

To restate the problem I believe you're trying to solve:

You've a use case when a carer will sent up a "virtual boundary" on a device. If that device leaves the bounded area, you'd like an alert sent via SMS sent to a predefined recipient, saying where that device is.

My suggestion would be to use something like OpenStreetMap maps (as they're free) for when you're setting up the virtual boundary. For their tiles (each 256px square), there is a relatively trivial method for converting between lat/long and pixel co-ordinates.

You might also be able to do what you want by cannibalising one of their existing Windows Mobile applications intended for surveying, such as OSMtracker, which already includes the map controls, downloads and the like, just leaving point 5 and part of point 4 on your list to tackle.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »