Archive for category Blackberry

Blackberry Networking Helper Class

I came across this “life-saver” helper class, it helps auto detect the appropriate connection type to use when making connections using the blackberry networking classes. I’ve spent a ton of time debugging issues in applications and this class really has helped. I didn’t write it, but I want to point other BB developers towards it.

http://www.versatilemonkey.com/blog/index.php/2009/06/24/networking-helper-class/

BBTrackr Help with “Tunnel Failed” error

I’ve worked with a few user’s of BBTrackr to fix the Tunnel Failed error.  If your on BIS you need to set your APN settings.

The  value for your network can be found here:
http://blackberryforums.pinstack.com/360-tcp_apn_wap_gateway_port_carrier.html

To configured the TCP settings in BlackBerry as follows:

menu => Options – Advanced Options - TCP and enter APN information per the link above.

I hope this helps!

bbtrackr fireeagle google maps GPS opencellid

Tags: , , , ,

BBTrackr Documentation Update

I’ve added some screenshots and basic documentation to the BBTrackr page.

http://www.apsquared.net/blog/bbtrackr/

BBTrackr 0.93

BBTrackr 0.93 was just released, highlights of this release are:

  • Much improved GPS support (automatic retries, error handling and improved GPS fix logic).
  • Confirmed success on Blackberry Bold (on AT&T) and Blackberry Curve (T-Mobile).
  • Option to only update FireEagle based on GPS coordinates (not OpenCellID).

As always please let me know how it goes and if you have ideas for other features.

Download Version 0.93 Here 

bbtrackr fireeagle google maps GPS opencellid

Tags: , , , ,

BBTrackr 0.81 – New Features

Just released version 0.81 of BBTrackr.  It now has a Settings screen that allows you to set the intervals at which OpenCell updates occur as well as FireEagle updates.  It also allows you to turn on AutoStart for both features (this just turns the tracking on when you launch BBTrackr).

Also a Google Map is embedded showing your location (based on either cell or GPS).  Just thought it be neat to see where BBTrackr thinks you are.

I haven’t had time to do anything more than a few tests so please let me know if anything doesn’t work right.  Also please let me know your ‘wish list’ for additional features.

Download BBTrackr 0.81 here. 

bbtrackr fireeagle google maps GPS opencellid

Tags: , , , ,

BBTrackr Update

After releasing BBTrackr yesterday it became apparent that it didn’t work on all phones.  Basically the issue was that it did not work on CDMA phones (Verizon and Sprint in the US).  A new version has been releases that does ‘work’ on CDMA phones.  However the ability to update the OpenCellID database is not functional as that database only works on GSM/GPRS phones (still verifying that).  You should be able to use the feature to update your FireEagle account just fine.

Since I don’t have a CDMA phone I could only test with a simulator so I’d appreciate it if someone with a CDMA phone could let me know how things go.

 The new version can be downloaded here.

OTA URL:  http://www.apsquared.net/BBTrackr.jad

bbtrackr Blackberry fireagle GPS

Tags: , , ,

Introducing BBTrackr for the Blackberry

I’ve made a simple application call BBTrackr.  It is currently in beta.

The application has two main features:

1) It uses both your phones GPS (or GPS Puck) as well as cell phone data to contribute to OpenCellID.org.  The OpenCellID project collects cell/location information sot htat location aware applications can be built for cell phones that do NOT have a GPS device.

2) The location information received from either the GPS or OpenCellID can be used to update FireEagle.  FireEagle is a location based service that allows numerous web application to know your current location so that they can provide you accurate and useful information.

Both of these features are just a tease for some of the features we are planning for the upcoming BlackBerry Application for our site, theSUGGESTR.com.  In the meantime support the OpenCellID project by downloading and running BBTrackr today.

Download BBTracker. 

OTA URL: http://www.apsquared.net/BBTrackr.jad

Blackberry fireeagle GPS opencellid

Tags: , , ,

Blackberry GPS/Location API

I just got finished playing with the blackberry Location API.  I was pleasently suprised how it easy it was to work with.  The key to it is that your phone must be a 4.2 BB OS phone (or upgraded to 4.2 like I did with my8700g) for the Location API to work with BT Pucks.   The two source files for a simple application are pasted below the app is call Spot Finder.

 Basically what it does is allows you to mark and save a location that you are currently in and then later find your way back to that location.  It will give you the distance and direction that you need to go.  Could be useful for remember your parking spot or the location of a bar you need to get back to.  Unfortately in my basic testing its accurate but not that accurate.  It’s not perfect but it is a interesting little application especially for learning the basics of the blackberry Location API. 

 You can download spot finder here. 

Java Source:

/* Spot Finder.java */

package com.apsquared.spotfinder;
import java.util.Enumeration;
import javax.microedition.lcdui.TextField;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.blackberry.api.invoke.*;
import javax.microedition.location.*;
public class SpotFinder extends MyApp {

public static void main(String[] args)
  {
  SpotFinder theApp = new SpotFinder();
  //To make the application enter the event thread and start processing messages, we invoke the enterEventDispatcher method
  theApp.enterEventDispatcher();
  }

MainScreen theMainScreen = null;
  RichTextField spotLocation = null;
  RichTextField currentLocation = null;
  RichTextField introMsg = null;
  RichTextField directions = null;

String storeName = "SPOT";

double spotLat;
  double spotLong;
  double curLat;
  double curLong;

public SpotFinder()
  {
  theMainScreen = createMainScreen();
  pushScreen(theMainScreen);
  }

private MainScreen createMainScreen()
  {

//Create a new screen for the applicatin
  MainScreen screen = new MainScreen();
  screen.addKeyListener(this);
  screen.addTrackwheelListener(this);
  introMsg = new RichTextField("Welcome to Spot Finder!");
  spotLocation = new RichTextField("Current Spot: ");
  currentLocation = new RichTextField("Current Location: ");
  directions = new RichTextField("");

screen.add(introMsg);
  screen.add(spotLocation);
  screen.add(currentLocation);
  screen.add(directions);
  //Add a field to the title region of the screen. We use a simple LabelField here. The ELLIPSIS option truncates
  // the label text with "..." if the text was too long for the space available.
  screen.setTitle(new LabelField("Spot Finder", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH));
  return screen;

}

public void setDirections(final String locStr)
  {
  UiApplication.getUiApplication().invokeLater (new Runnable() {
  public void run()
  {
  directions.setText(locStr);
  }});
  }

public void setIntroMsg(final String locStr)
  {
  UiApplication.getUiApplication().invokeLater (new Runnable() {
  public void run()
  {
  introMsg.setText(locStr);
  }});
  }

public void setCurLocation(double lat, double lng, float course, float speed)
  {
  curLat = lat;
  curLong = lng;
  String latLong = new String(curLat+" "+curLong);
  setCurLocation(latLong);

//TODO: check for valid spot
  Coordinates from = new Coordinates(curLat,curLong,0);
  Coordinates to = new Coordinates(spotLat,spotLong,0);
  float dist = from.distance(to) * (float)3.2808399 ;
  //i think calculation should be azimuth - course (+360 if value is neg)
  float dir = from.azimuthTo(to) - course;
  if (dir<0)
  dir+=360;
  setDirections("Distance: "+dist+" ft.\nDirection: "+dir);
  }

public void setCurLocation(final String locStr)
  {
  UiApplication.getUiApplication().invokeLater (new Runnable() {
  public void run()
  {
  currentLocation.setText("Current Location:\n"+locStr);
  }});
  }

public void setSpot(double lat, double lng)
  {
  spotLat = lat;
  spotLong = lng;
  String latLong = new String(spotLat+" "+spotLong);
  setSpot(latLong);
  }

public void setSpot(final String locStr)
  {
  UiApplication.getUiApplication().invokeLater (new Runnable() {
  public void run()
  {
  spotLocation.setText("Current Spot:\n"+locStr);
  }});
  }

public void msgBox(final String msg)
  {
  UiApplication.getUiApplication().invokeLater (new Runnable() {
  public void run()
  {
  Dialog.alert(msg);
  }});
  }

protected void makeMenu(Menu menu, int instance)
  {
  Field focus = UiApplication.getUiApplication().getActiveScreen().getLeafFieldWithFocus();
  if(focus != null) {
  ContextMenu contextMenu = focus.getContextMenu();
  if( !contextMenu.isEmpty()) {
  menu.add(contextMenu);
  menu.addSeparator();
  }
  }

MenuItem markSpot = new MenuItem("Get Current Spot",50,8) {
  public void run()
  {
  markSpot();
  }
  };

MenuItem saveSpot = new MenuItem("Save Current Spot",50,8) {
  public void run()
  {
  saveSpot();
  }
  };

MenuItem loadSpot = new MenuItem("Load Current Spot",50,8) {
  public void run()
  {
  loadSpot();
  }
  };

MenuItem findSpot = new MenuItem("Find Current Spot",50,8) {
  public void run()
  {
  findSpot();
  }
  };

menu.add(markSpot);
  menu.add(saveSpot);
  menu.addSeparator();
  menu.add(loadSpot);
  menu.add(findSpot);
  }

private void saveSpot()
  {
  LandmarkStore lStore = LandmarkStore.getInstance(storeName);
  if (lStore == null)
  {
  try
  {
  LandmarkStore.createLandmarkStore(storeName);
  }
  catch (Exception e)
  {
  msgBox("Error creating store. "+e.toString());
  return;
  }
  }
  try
  {
  lStore = LandmarkStore.getInstance(storeName);
  Enumeration e = lStore.getLandmarks();
  Landmark lMark = null;
  if (e!=null && e.hasMoreElements())
  {
  lMark = (Landmark) e.nextElement();
  lMark.setQualifiedCoordinates(new QualifiedCoordinates(spotLat,spotLong,0,Float.NaN, Float.NaN));
  }
  else
  {
  lMark = new Landmark("SPOT1","SPOT1",new QualifiedCoordinates(spotLat,spotLong,0,Float.NaN, Float.NaN),null);
  }
  lStore.addLandmark(lMark, null);
  msgBox("Spot Saved!");
  }
  catch (Exception e)
  {
  msgBox("Error saving spot. "+e.toString());
  }
  }

private void loadSpot()
  {
  LandmarkStore lStore = LandmarkStore.getInstance(storeName);
  if (lStore == null)
  {
  msgBox("No store to open.");
  return;
  }
  try
  {
  lStore = LandmarkStore.getInstance(storeName);
  Enumeration e = lStore.getLandmarks();
  while (e.hasMoreElements())
  {
  Landmark lMark = (Landmark) e.nextElement();
  setSpot(lMark.getQualifiedCoordinates().getLatitude(),lMark.getQualifiedCoordinates().getLongitude());
  break;
  }
  }
  catch (Exception e)
  {
  msgBox("Error saving spot. "+e.toString());
  }
  }

private void findSpot()
  {
  try
  {
  LocationProvider lPvd = LocationProvider.getInstance(new Criteria());
  lPvd.setLocationListener(new MyLocationListener(this,false), 5, 5, 5);
  }
  catch (Exception e){
  setIntroMsg("Error setting up location listener:\n"+e.toString());
  }
  }

private void markSpot()
  {
  try
  {
  LocationProvider lPvd = LocationProvider.getInstance(new Criteria());
  lPvd.setLocationListener(new MyLocationListener(this,true), 1, 1, 1);
  }
  catch (Exception e)
  {
  setIntroMsg("Error getting location:\n"+e.toString());
  }
  }

//empty - nothing to do on exit
  protected void onExit() {
  }

}

/* MyLocationListener */
package com.apsquared.spotfinder;
import javax.microedition.location.*;

public class MyLocationListener implements LocationListener {

SpotFinder sf;
 boolean onceOnly;

public MyLocationListener(SpotFinder sf, boolean onceOnly)
 {
  this.sf = sf;
  this.onceOnly = onceOnly;
 }

public void locationUpdated(LocationProvider provider,
  Location location)
 {
  QualifiedCoordinates qc = location.getQualifiedCoordinates();
  if (onceOnly)
  {
  sf.setSpot(qc.getLatitude(),qc.getLongitude());
  provider.reset();
  provider.setLocationListener(null, 0, 0, 0);
  }
  else
  {
  sf.setCurLocation(qc.getLatitude(),qc.getLongitude(),location.getCourse(),location.getSpeed());

}
 }

public void providerStateChanged(LocationProvider provider,
  int newState)
 {

}
}

Blackberry GPS java Programming

MLB Tracker Update

We’ve just released the latest version of MLB Tracker, version 0.85.  Amongst some minor bug fixes the biggest change is that we now have MLB Tracker working for both BIS and BES connected blackberry’s.

 If you own a blackberry and enjoy baseball be sure to give MLB Tracker a try!

Blackberry MLB Tracker

MLB Tracker 2007 Released

We’ve re-released MLB Tracker for 2007.  It has basically the same features (and bugs) as the 2006 edition, but we’ve updated it for the new URLs used by the site we scrape data from. 

MLB Tracker is an application for your blackberry that allows you to “virtually watch” a game by keeping an automatic feed of game activity coming to your laptop.  It also allows you to setup favorite teams so you can have quick access to their scores and games.  Click here to learn more.

 So far we’ve gotten feedback that this is working on both 4.1 (8700, 7100) and 4.2 (8100, 8800) phones.  However, some people are saying it is not working on phones connected to BIS (as opposed to BES).  If you have issues please try changing the option to “Use Device Side” option (assuming you’ve set the TCP settings on your phone).  If you hare having issues please let us know.

We’ve decided to keep MLB Tracker free again and for those that use it we ask only one favor, please check out and regsiter for our site http://www.myfriendsuggests.com.  We’d love your help growing our site as the more people on the site the better it will be (and the more time we’ll have to work on MLB Tracker :-) ).  Sorry for the cheap plug but we had to do it.

If you have any issues or recommendations for MLB Tracker post them as comments to this post. 

Baseball Blackberry MLB MLB Tracker Track Game
Close
E-mail It