Tuesday, September 15, 2009

Add APN to your Application in BlackBerry Device-you can access to network from anywhere in the world with any service provider without resetting APN

This Method returns Correct APN to user at run time

public String Getapn()
{

String apn=””;

//is there any other apns add them to following array by replacing empty strings

String[] arr= {"","internet.com","blackberry.net","internet2.voicestream.com","wap.voicestream.com","dialogbb",""};
int i=0;
int j=0;
while(i==1&&j<6)
{
j=j+1;
try
{

//test sending request to google.com here get page method you will find in

//my blog that basically returns page of given address
getPage("http://www.google.com"+";trustAll;deviceside=true;apn="+arr[j]);
i=1;
}
catch (Exception e)
{
}
}
apn=arr[j];

return apn;
}

1 comment:

  1. where will i write or paste this for heavens sake?

    ReplyDelete