Search code examples
blackberrydevicesup

SUP101: blackberry works on simulator but not device


I'm having a problem with getting the tutorial to work on the device

it works fine in the simulator, but when I try to run it on the device it doesn't work.

I put some logs and it seems to come from the login function

===JASONROGERS292C 2480 supAdmin s3pAdmin
[0.0] TAC:TAI.handleRegRsp : ALREADY_REGISTERED
[0.0] TAC:TAI.handleRegRsp : (ALREADY_REGISTERED), registered entry found:{{APN=,id=2,state=CLOSED,waf=WAF[0.0] _3GPP,keepAlive=300,IP=0.0.0.0,dnsSrv=0.0.0.0}}
[0.0] [TMM.TunnelAllocator]:runNotReadyListeners: registered listeners found
[0.0] TAC:TAI.handleListenerDeRegRsp: not existent tunnel in TAC, tid=2
[0.0] SIM cache not loaded

has anybody got an idea what I forgot to do when running the code on a device?

Cheers Jason


edit:

a couple of links towards what I'm doing (I can post all the code people want but its the standard generated code form SUP, which mean a lot of code lol)

The tutorial http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc01214.0200/doc/html/title.html

the zip to the already done tutorial : http://www.sdn.sap.com/irj/bpx/index?rid=/webcontent/uuid/40ea4956-b95c-2e10-11b3-e68c73b2280e


Solution: I was missing a couple of things: 1) Specify that the app should use Wifi

SUP101DB.getSynchronizationProfile().setString("transport", "WIFI");

2) Check that the DNS: in my case the server was local to my windows (through parallels) so I had to specify the ip and not the namespace

getSynchronizationProfile().setServerName("10.50.30.108");//"JASONSERVER");

Solution

  • I downloaded the SUP 101 - BlackBerry Project and checked the sources.

    It does not contain networking code in the form a usual BB app would do.

    However I see the SUP101.SUP101DB class has the following method:

    private static String getSyncTransportSuffix() {
        com.sybase.persistence.ConnectionProfile syncProfile = 
            getSynchronizationProfile();
        return com.sybase.afx.util.NetworkUtil.getTransportUrlSuffix(syncProfile);
    }
    

    So the code uses com.sybase.afx.util.NetworkUtil to get url suffix. By appending such suffix to a url we say to the underlaying BB API what network transport to use. Unfortunatelly sources do not contain com.sybase.afx.util.NetworkUtil to look how exactly it works.

    I should say that even with native Java BB development detecting a proper network transport may turn to be a very tricky part. OS 5+ provides a new networking API that is much better, but for the older OS it is hard. This SUP project is built with BlackBerry JRE 4.6.1, so it can not use new OS 5+ networking API. Who knows maybe SUP simply fails to detect proper network transport?

    Any way, just a few ideas to try:

    • check for APN settings on the device, sometimes they have to be populated in order to use Direct TCP transport (it depends on wireless provider requirements). APN name/pass are wireless provider specific. Usually googling allows to find proper APN settings for a provider.
    • if your device has WiFi try enabling it. SUP should be smart enough to prefer WiFi if available. In this case I assume networking should have no issues.