Code sample: Specifying the PDE server information
import net.rim.device.api.gps.*;
import javax.microedition.location.*;
public class handleGPS
{
static GPSThread gpsThread;
public handleGPS()
{
gpsThread = new GPSThread();
gpsThread.start();
}
private static class GPSThread extends Thread
{
public void run()
{
if ( !GPSInfo.isGPSModeAvailable(GPSInfo.GPS_MODE_ASSIST) ||
!GPSSettings.isPDEInfoRequired(GPSInfo.GPS_MODE_ASSIST))
return;
BlackBerryCriteria myCriteria =
new BlackBerryCriteria(GPSInfo.GPS_MODE_ASSIST);
try
{
BlackBerryLocationProvider myProvider =
(BlackBerryLocationProvider)
LocationProvider.getInstance(myCriteria);
String user = "UserID";
String pass = "Password";
String ip = "127.0.0.1";
int port = 0;
String str = ip + ";" + user + ";" + pass;
GPSSettings.setPDEInfo(str, port);
try
{
BlackBerryLocation myLocation =
(BlackBerryLocation)myProvider.getLocation(10);
}
catch ( InterruptedException iex )
{
return;
}
catch ( LocationException lex )
{
return;
}
}
catch ( LocationException lex )
{
return;
}
return;
}
}
}
Was this information helpful? Send us your comments.