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

Like it? Share it!


Home
Interfacing with AndNav PDF Print E-mail
Written by Nicolas Gramlich   
Tuesday, 25 November 2008 03:54

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

Last Updated on Tuesday, 25 November 2008 05:02
 

bottom

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