08-09-2010 02:09 PM - edited 08-09-2010 02:11 PM
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.
08-09-2010 05:41 PM - edited 08-09-2010 05:46 PM
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.
08-09-2010 06:01 PM
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?
08-10-2010 03:37 AM
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.
06-03-2011 03:26 AM
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.
08-18-2011 07:28 AM
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
08-18-2011 07:31 AM