top
logo
Deutsch (DE-CH-AT)English (United Kingdom)

Like it? Share it!

Login Form




Home
Interfacing with AndNav PDF Drucken E-Mail
Geschrieben von: Nicolas Gramlich   
Dienstag, 25. November 2008 um 03:54 Uhr
There are no translations available.

Hello Developers,

 today I want to introduce the nice and small AndNav-API to you all. With this tiny example you can make any application use the full navigation capabilities of AndNav2 and or AndNav1. This API can be useful for any application, especially all kinds of Piggyback- or FriendFinder-Applications!

This is how you do it. Nothing more, nothing less:

 


    // Both(!) AndNav1 and AndNav2 will react!
    public static final String ANDNAV_NAV_ACTION = "org.andnav.intent.ACTION_NAV_TO";

    // Only AndNav2 will react!
    public static final String ANDNAV2_NAV_ACTION = "org.andnav2.intent.ACTION_NAV_TO";
    
    private void sampleNavRequest() {
        final Intent navTo = new Intent(ANDNAV2_NAV_ACTION);

        // Create a bundle that will transfer the routing-information
       final Bundle b = new Bundle();
        
        final ArrayList<String> vias = new ArrayList<String>();
        vias.add("50.119539,8.658031"); // "Latitude,Longitude"
        // Add as many waypoints as you want here
       
        b.putString("to", "50.133089,8.66729"); // "Latitude,Longitude"
        b.putStringArrayList("via", vias);
        
        navTo.putExtras(b);

        sendBroadcast(navTo);
    }


 

I think this sample is pretty clear, but please do not hesitate to ask any open questions in the comments Smile.

Note: AndNav2 will contain this interface from the first public release - AndNav1 from the next update!

Best Regards,
Nicolas

Zuletzt aktualisiert am Dienstag, 25. November 2008 um 05:02 Uhr
 

Comments  

 
0 #3 marko12 2009-05-05 19:55 I installed andnav2.apk on android emulator fact the icon appears in menu and with eclipse, I entered your code and I get the icon of the program to select android and I exit a window black. Quote
 
 
0 #2 Nicolas Gramlich 2009-05-05 19:40 If AndNav½ is installed, it should pop up… Quote
 
 
0 #1 marko12 2009-05-04 20:35 hello
I can not run the code above.
inserted in the java and when I start the application by android gives me a screen black.why?
Quote
 

Add comment


Security code
Refresh


bottom

Powered by Joomla!. Designed by: Free Joomla Themes, hosting.  Valid XHTML and CSS.