| GPSiesConnect for DevelopersAccess to GPSies.com directly from your BlackBerry® DevicesSearch for tracks for your sports and leisure activities. |
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 '
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();
}
navi'.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()+"]");
}
}
}
}
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()+"]");
}
}
}
}
gpsiescon_module_name' method example
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();
}