Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: wifi ip address

[ Edited ]

A BlackBerry handheld can connect to multiple packet-switched data networks (PDN) at the same time. For example, the Internet accessible via an internet APN, a private network accessible via a private APN (e.g., a company private APN or "blackberry.net" to access the RIM network infrastructure), or a WLAN accessible via the WLAN (Wi-Fi) network interface. On each of these networks the handheld has an IP address to enable it to communicate via the IP layer (e.g., TCP, UDP, ICMP).

 

When accessing a PDN via the cellular network the handheld has to open a PDP context specifying the APN and various additional settings such as quality of service. Once the PDP context is opened, an IP tunnel is established from the device to the PDN and the PDN-side end of the tunnel is assigned an IP address. You can query this IP address via RadioInfo.getIPAddress(int apnId).

 

I suspect when the network stack had to be modified to support Wi-Fi, RIM decided to make the WLAN accessible via Wi-Fi look very similar to PDNs accessible via APNs/PDP contexts. So, they created a virtual APN called MagicRudyAPN.rim. Somewhere deep inside the OS there's probably a corresponding IP tunnel implementation that simply sends and receives packets from the WLAN network interface without tunnelling the packets via a PDP context to the cellular carrier's core network.

 

Clearly, even if all of the above is more or less correct, RIM could rename this virtual APN or get rid of completely in the future versions of their OS. The existence of this APN is just an implementation detail of the OS.

Developer
Posts: 709
Registered: ‎09-10-2009
My Device: 8520, 8900, 9000, 9300, 9650, 9700, 9780, 9800, 9810, 9900, 9930
My Carrier: Verizon

Re: wifi ip address

[ Edited ]

klyubin,

 

That might not be correct. I got a few BBs from ebay last month and they all got wiped to their original setting and OS, no APN setting at all, not activated with RIM. However, I was still able to browse the internet with wifi and still be able to run my voip program - WIFI only of course.  I think they modify the wlan layer to make it work with PDN, not the other way around as you indicated.

 

Edit. Back to topic. I obtain the WIFI IP address by creating a UDP socket and getLocalAddress (IIRC). However, be warned, getting an IP address does not mean you are connected. Some hot spots requires you to logon through a broswer. A sure thing to do is have the device ping an echo server out on the net to make sure you're actually on the net.

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: wifi ip address

Aviator168, are you saying that if you enable debug-level logging of everything in the Event Logger and/or iterate over all used APNs using RadioInfo and/or dump the APN names from the RadioStatusListener.pdpStateChange then you don't see any mention of the "MagicRudyAPN.rim" APN on your device?

Developer
Posts: 709
Registered: ‎09-10-2009
My Device: 8520, 8900, 9000, 9300, 9650, 9700, 9780, 9800, 9810, 9900, 9930
My Carrier: Verizon

Re: wifi ip address

No. That's not what I am saying. Those phones I got had all the settings resetted to factory setting. They are not associated with any carrier.

Developer
Posts: 16,786
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: wifi ip address

magic rudy is not a carrier setting. it is a virtual apn stored in the firmware. you can wipe devices all you can, it will still be there.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 402
Registered: ‎11-26-2010
My Device: Torch

Re: wifi IP address

I just want to add that in my case I was connected in a VPN through wi-fi and the approach with "MagicRudyAPN.rim"

does not work on newer devices with OS 6.0.

 

On older devices with OS prior to 6.0 the "MagicRudyAPN.rim" approach works and the IP address returned is the one which corresponds to the IP given to the device in the VPN.

 

However on Bold 9780 with OS 6.0 the above approach returns the address of the device in the wifi network and simply does not recognize that the device is connected to a VPN. In this case the approach that worked for me is the one where you create a UDP socket in server mode and use getLocalAddress() to get the IP.

----------------------------------------------------------------------
Press the button to give kudos if I helped you Smiley Happy
New Developer
Posts: 40
Registered: ‎12-04-2009
My Device: Storm 9530

Re: wifi ip address

Hi,

I have used above code to get ip address but i am getting error (i.e Method "toString" with signature "()Ljava/lang/String;" is not applicable on this object) Please help me to solve it

 

 

 

Thanks in advance

Highlighted
Developer
Posts: 16,786
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: wifi ip address

that is only a debug error, not a problem with your code. use sysout instead.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter