Leveraging Blackberry Platform
Anatomy of BlackBerry Applications
The lifecycle of these applications are like much Java applications. The entry point for any application is the main () method. All applications in general are started when the main method entry point is invoked and are destroyed when this method returns. Applications can start when a user clicks and invokes it, at start-up or when invoked by another application. User interface related applications must extend the UIApplication class and the rest without a UI must invoke the Application class. Generally speaking the UI applications are single threaded and hence an application generally exits when the last screen is removed or closed.
How Does Telenav Connect Adapter work
It all begins with installing the Telenav Navigator client on a device running the Android OS. The Telenav Navigator client registers itself as a consumer for application intents using a Broadcast Service model on the Android platform. The adapter code abstracts this level of detail from an application developer. The Application Developer is only responsible for creating a URI which is conformant to the Telenav Connect Specification. The following sequence diagram provides a look into what is really happening under the hood. The MaiTaiAdapter shields the developer from the process communication/communication protocol mechanics and lets the developer focus on integrating with the TN Navigator.



 

import net.rim.device.api.system.Application;
import net.rim.device.api.ui.MenuItem;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.BasicEditField;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.component.Menu;
import net.rim.device.api.ui.container.MainScreen;

import com.telenav.sdk.maitai.IMaiTaiAdapterCallback;
import com.telenav.sdk.maitai.MaiTaiAdapterFactory;
import com.telenav.sdk.maitai.rim.MaiTaiAdapter;
import com.telenav.sdk.maitai.rim.URIUtil;


public class MaiTaiTest extends UiApplication implements IMaiTaiAdapterCallback
{
                
                .....
                
    IMaitaiAdapter adapter;
    
    MaiTaiContext context;

    public MaiTaiTest()
    {
        main = new MainUiScreen();
        context = new MaiTaiContext(this,this); 
        adapter = MaiTaiAdapterFactory.createMaiTaiAdapter(context);
        makeMenu(..);
        
        main.show();
    }

    public static void main(String[] args)
    {
        MaiTaiTest integrate = new MaiTaiTest();
        integrate.enterEventDispatcher();

    }

    public void maitaiResponse(String uri) {
        System.out.println(uri);
    }
    
    
    protected void makeMenu( Menu menu, int instance )
                {   
                            //driveTo Menu
                            MenuItem driveTo = new MenuItem(MENUITEM_DRIVE_TO, 100, 10)
                            {
                                public void run()
                                {
                                    String str = "telenav://navTo?v=1.0&k=" + DEV_KEY + "&addr=1130+Kifer+Rd,102,Sunnyvale,CA+94086,USA&cb="
                                    		+ "planner://contact/43234";
                                    adapter.request(str);
                                }
            };

    }
    
    
    ...


}
										
FOLLOW US