开发者

Blackberry MapView not working on Device, while working on Simulator

I'm working on a BlackBerry application that uses a MapView. At the moment, I'm only showing the MapView, nothing more. This is a snippet from the code I use for it:

public class MapScreen extends MainScreen {
  private MapField map;

  public MapScreen() {
    super(MainScreen.NO_VERTICAL_SCROLL);

    map = new MapField();
    map.moveTo(new Coordinates(50.847573,4.713135, 0));
    add(map);

    //...
  }

  //...
}

I'm using net.rim.device.api.lbs.MapField because I have to be compatible with OS 5.0

On the simulator, everything's fine and it's working. But the moment I deploy it on the device, I see a white screen...

The device has an internet connection, 开发者_StackOverflow社区but only over Wi-Fi. First I was thinking that that was the problem, but according to "Blackberry services that are available over Wi-Fi connections", it shouldn't be a problem.

So, does anybody know why it's not working on the device, and how I can solve this? Thanks


You say "the device has an internet connection, but only over Wi-Fi" which makes me beleive you don't have the real device provisioned with a BlackBerry data plan. You need that plan in order to access any BlackBerry services, even over Wi-Fi.

To check for an appropriate connection you can use:

if (CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_BIS_B) {
   // Connection will support BlackBerry services
} else if (CoverageInfo.isCoverageSufficient(CoverageInfo.COVERAGE_MDS) {
   // Connection will support BlackBerry services if BES allows the connection to BIS servers.
}


A better way of checking for this is to check the ServiceBook entries for LBSConfig or variants thereof.

That allows devices that are no longer on a plan, but were once configured by one with LBS, to function properly.

private static final boolean have_lbs() {
    ServiceBook sb = ServiceBook.getSB();
    ServiceRecord[] records = sb.getRecords();
    int count = records.length;
    for (int ii = 0; ii < count; ++ii) {
        if (records[ii].getCid().toUpperCase().startsWith("LBS"))
            return true;
    }
    return false;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜