satish Bhor
satish Bhor

Reputation: 101

About Blackberry Phone IP Address

How we can programatically get or set blackberry Phone IP Address?

Upvotes: 0

Views: 696

Answers (1)

y0rk
y0rk

Reputation: 396

You can't set ip address. You can get ip address

public static String getIPAddress() {

    int apnId = 0;
    try {
        apnId = RadioInfo.getAccessPointNumber("MagicRudyAPN.rim");
    } catch (RadioException e) {
        Log.e(e);
        e.printStackTrace();
    }

    byte[] ipByte = RadioInfo.getIPAddress(apnId);
    String ip = "";
    for (int i = 0; i < ipByte.length; i++) {
        int temp = (ipByte[i] & 0xff);
        if (i < 3)
            ip = ip.concat("" + temp + ".");
        else {
            ip = ip.concat("" + temp);
        }
    }

    Log.s(TAG + "Returning IP=" + ip);
    return ip;
}

Please check http://supportforums.blackberry.com/t5/Java-Development/wifi-ip-address/m-p/374279 for details.

Upvotes: 2

Related Questions