Use the google Navigation app in my own app

Put your problem here if it does not fit any of the other categories.

Use the google Navigation app in my own app

Postby Chri » Mon Jan 02, 2012 6:38 pm

Hi guys,

Do anybody know, if it´s possible that you use the google navigation app in your own app.
I would like to bind the app in a my own tablet app, so it should fill the half of the screen.
On the other halfe I would like to show own information.

Would be very kind, if somebody could help me.

wkr
Chris
Chri
Experienced Developer
Experienced Developer
 
Posts: 51
Joined: Mon Aug 31, 2009 12:08 pm

Top

Re: Use the google Navigation app in my own app

Postby Phyll » Mon Jan 02, 2012 8:45 pm

Hi Chris,

Google has an api for that. http://code.google.com/apis/maps/docume ... irections/

I haven't used this api but with this you would send Google endpoint information and it would send you back directions. You can use that with Google maps api to draw your map and draw the direction info on it.

Other direction services might have web sites that you could send info to and receive html back. Then handle that on one half of your display. Just an idea. Don't have any particular service in mind.

Hope this helps.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Re: Use the google Navigation app in my own app

Postby Chri » Mon Jan 02, 2012 8:54 pm

Thank you Phyll for your quick reply!

Sounds quite well, just a bit complicated.
If there is no other solution I will try it out and maybe post my results.

wkr
Chris
Chri
Experienced Developer
Experienced Developer
 
Posts: 51
Joined: Mon Aug 31, 2009 12:08 pm

Re: Use the google Navigation app in my own app

Postby Phyll » Mon Jan 02, 2012 8:59 pm

Hi Chris,

I haven't seen a good tutorial on that exactly. So it might be nice to have one. Won't be so complicated for everybody else.

Thanks,

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Re: Use the google Navigation app in my own app

Postby Chri » Mon Jan 02, 2012 9:18 pm

I will try it out, but maybe I need some help too :), before I can write a tutorial.

Would be very nice, if I can count on you in this matter.

wkr Chris
Chri
Experienced Developer
Experienced Developer
 
Posts: 51
Joined: Mon Aug 31, 2009 12:08 pm

Re: Use the google Navigation app in my own app

Postby Phyll » Mon Jan 02, 2012 11:17 pm

Hi Chris,

I tried one of the example url's from that page. Got a big json file back just like it said. Don't have to time to do much with it right now. Do you have a key for Google maps yet? Kind of a chore. Do you know how to do the maps part of it?

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Top

Re: Use the google Navigation app in my own app

Postby Chri » Tue Jan 03, 2012 8:20 am

I tried it too :) , quite nice, what you get back.

I have found a section i a book of mine, where the google maps part is explained.
So, that would not be the problem.

Ok, then I have to try it out alone.
Some last question: Do you think that xml or json is better to work with in this case?

Wkr Chris
Chri
Experienced Developer
Experienced Developer
 
Posts: 51
Joined: Mon Aug 31, 2009 12:08 pm

Re: Use the google Navigation app in my own app

Postby Phyll » Tue Jan 03, 2012 12:09 pm

Hi Chris,

According to the docs, they prefer the json. Here is a tutorial on using json with map stuff:

http://p-xr.com/android-tutorial-how-to ... -listview/

If you have any trouble with the Google maps let me know. You need to find keytool and your keystore. After that it's not too bad.

Should be a nice project.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Re: Use the google Navigation app in my own app

Postby Chri » Tue Jan 03, 2012 12:48 pm

I will see which one is the best solution. Either xml parsing or json parsing.

Thanks for your help Phyll until this point.

wkr Chris
Chri
Experienced Developer
Experienced Developer
 
Posts: 51
Joined: Mon Aug 31, 2009 12:08 pm

Re: Use the google Navigation app in my own app

Postby Chri » Sun Jan 15, 2012 5:26 pm

So... json parsing is definitively the best solution:
http://stackoverflow.com/questions/7237 ... ndroid-app

Now I am trying to understand how to get the directions (like turn left arrow) from the google map api.
The html text is providing it but not which arrow should be painted.
That information is somewhere in the code because google maps routes shows such an arrow. (At every route entry on the left side (just try it out on: http://maps.google.at/ ))

Hope you can help!
Chri
Experienced Developer
Experienced Developer
 
Posts: 51
Joined: Mon Aug 31, 2009 12:08 pm

Re: Use the google Navigation app in my own app

Postby Phyll » Sun Jan 15, 2012 7:00 pm

Hi Chri,

I'm not sure if this is what you are after or not, but Google has a class built into the maps api v3 that I think can do all that for you. I haven't tried. The last I knew I believe I read that you had to do it yourself. Try looking thru this:

http://code.google.com/apis/maps/docume ... tions.html

Hope this helps.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Re: Use the google Navigation app in my own app

Postby Chri » Sun Jan 15, 2012 8:33 pm

Good idea, but unfortunately it´s not what I am looking for, because it´s java script code and not available (as far as i know) in android.

wkr Chri
Chri
Experienced Developer
Experienced Developer
 
Posts: 51
Joined: Mon Aug 31, 2009 12:08 pm

Re: Use the google Navigation app in my own app

Postby Phyll » Sun Jan 15, 2012 9:38 pm

Hi Chri,

I'm sorry, I missed that subtlety. I guess I'll have to fall back to my first reaction, you could make a class that extends the Overlay class from Google maps and then override the draw method to do anything you want on the map. Its pretty easy I think to translate geographic coordinates like you get back from the direction service to coordinates on the screen and just draw things between them or on them.

Does that help?

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Re: Use the google Navigation app in my own app

Postby Chri » Mon Jan 16, 2012 10:55 am

To set an overlay and drawing on them should not be a problem.

I am just still looking how to get the arrow information (which arrow should be painted) from the json response.
Chri
Experienced Developer
Experienced Developer
 
Posts: 51
Joined: Mon Aug 31, 2009 12:08 pm

Re: Use the google Navigation app in my own app

Postby Phyll » Mon Jan 16, 2012 12:27 pm

Hi Chri,

I saw this:

Code: Select all
       "start_location": {          "lat": 41.8507300,          "lng": -87.6512600        },        "end_location": {          "lat": 41.8525800,          "lng": -87.6514100        },        "polyline": {          "points": "a~l~Fjk~uOwHJy@P"


The only thing I see here is the polyline info which is mimed or something. I'm thinking it is information to place a line on the map to follow. I don't see anything in particular to do with arrows. From this information, start, end you could develop a line and one parallel to it along which you could place your arrows. You have two points, that's enough to get the equation for a line and then work out the rest. I'm thinking they do something like that.

Hope this helps.

Phyll
Phyll
Master Developer
Master Developer
 
Posts: 648
Joined: Fri Oct 14, 2011 11:19 am

Top
Next

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 10 guests