Access to GPSies.com for BlackBerry® Devices
with OS 4.2.1 or higher


YOUR AD could be here...

[home]|[faq]|[help]|
Follow emacberry on Twitter

YOUR AD could be here...

 

GPSiesConnect for Developers

Access to GPSies.com directly from your BlackBerry® Devices

Search for tracks for your sports and leisure activities.

  [GPSiesConnect home]|[Product details]|[Download]|[Changelog]|[Screenshots]|[for Developers]

How to write an application that can interact with GPSiesConnect

Use your Application from GPSiesConnect

Loading a Track from GPSies.com and launch your application with the path/url of the downloaded track

In order that users can use your application from GPSiesConnect all you have to do is to support command line option(s) in your application. Basically this will be done by adding some lines in your main method of your starting class.

public static void main(String[] args) {
final GPSLogger logger = new GPSLogger();
if(args.length>0){
try {
// The path manager is able to load a track in any format
// (KML, GPX, FUWAGI, etc.)

Path p = PathManagerScreen.loadPath(args[0]);
// depending on the additional passed comand line
// parameter the track will be loaded as nagigation path
// or as normal path (viewing mode)

if(args.length>1 && args[1].equalsIgnoreCase("navi")){
logger.setNavigationPath(p);
} else {
logger.setPath(p);
}
// after a path is loaded we are forced to rescale our
// display

logger.getMCP().forceRescaleScreen();
} catch (Exception e) {}
}
// finally starting the application by enterying the event dispatcher...

logger.enterEventDispatcher();
}

Once you support an additional command line in your Application - GPSiesConnect users can select via the Option: 'GPS Application' your application and specify the format in which your application is going to accept the track file [KML, GPX, CVS or FUWAGI]. If required you can add an additional command line parameter that will be passed to your application. In the example above the GPSLogger Application will use the additional parameter 'navi'.

Summary:

Support additional command line parameter(s) in the main method of your application and then users can set up GPSiesConnect to use our application directly from GPSiesConnect. As soon as an GPS Application is defined in the GPSiesConnect option an additional Buttons and Menus will be visible in GPSiesConnect in oder to allow the user to start your application with the current selected Track.
Following parameters should be supported:
  1. command line parameter will be the url of the file to which GPSiesConnect have downloaded the track in the specified format
  2. command line parameter is any optional parameter the users can specify in the GPSiesConnect GPS Application Options

Use GPSiesConnect from your Application

Upload a track from your application to www.GPSies.com via GPSiesConnect

Once you start to use the GPSies.com database it's more then fair that you also support uploading new tracks to GPSies.com in order to contribute something to the track sharing community. Uploading a track is quite an easy task - once you have understood the concept of the command line parameters.

You have to provide a file that containing the track data in one of the formats that is supported by GPSies.com. Personally I recommend the very simple FUWAGI format since this have the smallest overhead. It's a simple text list of latitude, longitude, altitude and time information with a very small header.


public void uploadInGPSiesConnect(Path path){
String filePath = Exporter.exportFugawi(path);
if(filePath!=null){
// actually you should check, if GPSiesConnct is installed!
// the variable gpsiescon_module_name will can be retrieved
// in a simple additional method

ApplicationDescriptor[] ads =
CodeModuleManager.getApplicationDescriptors(
CodeModuleManager.getModuleHandle(gpsiescon_module_name)
);
// the command line parameters for GPSiesConnect:
// "upload": triggering the upload function
// "FUWAGI": the file format [can be GPX, KML or FUWAGI]
// filePath: the URL to the file you would like to upload

ApplicationDescriptor appDescriptor =
new ApplicationDescriptor(ads[0], new String[] {"upload", "FUGAWI", filePath});
try {
ApplicationManager.getApplicationManager().runApplication(appDescriptor, true);
} catch (Exception e) {
synchronized (UiApplication.getUiApplication().getAppEventLock()){
Dialog.alert(e.getClass().getName()+" ["+e.getMessage()+"]");
}
}
}
}

Start a Search for Tracks from your current location in GPSiesConnect

When you have the current location information (latitude & longitude) from the GPS antenna then you can call GPSiesConnect directly with this location information in order to search for tracks in the GPSies.com database.

public void searchInGPSiesConnect(Point aPoint){
if(aPoint!=null){
// aPoint is a object that store lat and lon as double in WGS84

String lat = aPoint.getLatitude()+"";
String lon = aPoint.getLongitude()+"";
ApplicationDescriptor[] ads =
CodeModuleManager.getApplicationDescriptors(
CodeModuleManager.getModuleHandle(gpsiescon_module_name)
);
// the command line parameters for GPSiesConnect:
// "search": triggering the search function
// "lat": the Latitude value as String
// "lon": the Longitude value as String

ApplicationDescriptor appDescriptor =
new ApplicationDescriptor(ads[0], new String[] {"search", lat, lon});
try {
ApplicationManager.getApplicationManager().runApplication(appDescriptor, true);
} catch (Exception e) {
synchronized (UiApplication.getUiApplication().getAppEventLock()){
Dialog.alert(e.getClass().getName()+" ["+e.getMessage()+"]");
}
}
}
}

Getting the 'gpsiescon_module_name' method example

To be able to launch GPSiesConnect from your application you need to know the module name - this simple method will return the module name of GPSiesConnect once it's installed on the the device.

private Boolean isGPSiesConnectInstalled = null;

public boolean isGPSiesConnectInstalled() {
if(isGPSiesConnectInstalled==null){
isGPSiesConnectInstalled = Boolean.FALSE;
try{
int val = CodeModuleManager.getModuleHandle("com_emacberry_GPSiesConnect");
if(val>0){
isGPSiesConnectInstalled = Boolean.TRUE;
}
}catch(Exception e){}
}
return isGPSiesConnectInstalled.booleanValue();
}

  [GPSiesConnect home]|[Product details]|[Download]|[Changelog]|[Screenshots]|[for Developers]

[FileScout]|[iMazing]|[Iconify]|[TOMPlayer]|[LittleBrother]|[GPSLogger II]|[GPSiesConnect] Follow emacberry on Twitter

[home][faq]|[help]| (please understand that help & support can't be provided via mail)

 © 2010 emacberry.com