06-12-2012 05:20 AM - edited 06-12-2012 05:25 AM
Hello to everyone!
I've been searching a information on this matter, but haven't seem to found a solution.
I am developing a Smartphone application which needs to connect to a server to retrieve some data. So I'm using a direct connection with the correct settings (I hope):
url = " server url"+ "deviceside:true" + "apn: ......"
The problem is that the connection should be done without hardcoding the "apn". These are the tests I have done so far (assuming I am always adding the "deviceside : true" parameter):
URL (logical name) + apn OK!
URL (logical name) FAIL
URL (static ip) OK !
*by logical name I mean an url like www.google.com
What I need is to just use the logical name, without the apn parameter!! Maybe I'm missing another parameter which I am not aware of??
Some additional info which might be useful!:
- The server is a Vodafone server which, as it has been explained to me, should be on a RIM's white list (not sure what this means, but I guess it has to do with the fact that BB connections pass through RIM's servers at some point, and being in this list gives some kind of "privilege" when going through RIM's servers), and I am sure it is publicly accesible because (see next point)
- An android version of the application works fine without hardcoding the apn and using the logical name (I guess this has to do with RIM's servers! )
Any help or any ideas towards resolving this is greatly appreciated!!! if I'm missing some info which you think I should add! please tell me so!
Thanks for your help!!
Solved! Go to Solution.
06-12-2012 11:42 AM
Read up on ConnectionFactory API.
Here is aome good background readng too:
06-13-2012 05:01 AM
I was able to resolve it by looking at the code from the Network Api alternative in the link you sent me!
The solution was adding the ConnectionUID parameter to the url String! as to why this resolves the problem I still don't understand it! (If you can enlighten me with the reason, I'd be most grateful )
This value was found inside the service books!, I post the code just in case it helps somebody!
String mUid = null;
ServiceBook sb = ServiceBook.getSB();
ServiceRecord records = sb.getRecords();
for (int i = 0; i < records.length; i++)
String cid = records[i].getCid().toLowerCase();
String uid = records[i].getUid().toLowerCase();
if ((cid.indexOf("wptcp") != -1) && (uid.indexOf("wifi") == -1) && (uid.indexOf("mms") == -1))
mUid = records[i].getUid();
and then add the parameter : ConnectionUID=mUid
Again, Thank you!!
06-13-2012 06:54 AM
"(If you can enlighten me with the reason, I'd be most grateful )"
Instead of using direct TCP, the option you are now using is WAP2, i.e the carrier gateway that was intended to be used for WAP web sites. The code you have will work for any carrier. The isue with WAP is that I understand it is chargeable for some users.
In fact, for Vodafone, my experience suggests that WAP2 is the default connection method for Vodafone devices. In addition, when Vodafone white lists a web site, my experience is that means that Vodafone (the carrier) will let you through to this site and will NOT interfere with the data passed between mobile phone and device (which they apparently can do). This white listing only applies to Vodafone (as I understand it).
Anyway, if you are writing something for Vodafone, I think what you have is OK. If you are writing it to be used in other carriers, then I'm not usre. You might also think about popping up a warning that the data may cost the user.
06-14-2012 09:16 AM