Sunday, June 3, 2012

BlueVPN+, connect your Android device to internet with a GPRS modem phone

In the previous post we saw how to pair two Android devices and share the internet connection between them with BlueDUN installed on the master and BlueVPN installed on the slave.   In particular we described how install and configure the BlueVPN:  this app implements a bluetooth dial up client, also called reverse DUN feature.  
However, there are situations where you need to connect an Android device, for example a tablet, and you don't own a second Android device (generally a phone), but you have only a GPRS [General Packet Radio Service] phone (like many common BlackBerry, Nokia, Samsung ...phones) with tethered modem capability.
Till now, you has been able to use this phone as an external modem to connect a laptop computer to the Internet but not to connect the Android device.
The last release of BlueVPN for Android ICS (4.0.x) enables the internet connection of Android devices through dial up modem phones and so bypasses this limitation.

To setup the connection you may follow the same steps described before:  enable the bluetooth on both Android and no-Android device and create the BT pairing.    For an unknown Android limitation it is strongly recomended to remove any space in the Bluetooth device names before the pairing ( for example:  rename "Nokia E65" to "NokiaE65" )

The main differences are in the setting parameters:

Modem compatibility:    some modems don't allow multiple lines for AT commands; if you enable this option the AT commands are not prefixed with <cr><lf> ("carriage return" and "line feed")
For example:    compatibility disabled:  <cr><lf>AT<cr><lf>  ;  compatibility enabled:   AT\<cr><lf>

Modem line feed:    if you disable this option the AT commands will use only the "carriage return" character (<cr>) otherwise thery will use both the "carriage return" and "line feed" (<cr><lf>)
For example:    compatibility disabled:    <cr>AT<cr>  ;     compatibility enabled:   AT<cr>

AT Initialization:  it is the modem initialization string, the default is E0V1&C1&D2  but you can change it according to your modem specifications

Connection Timeout:  is the time after which the app will resend the same data if it doesn't receive the replay for the first AT command or first LCP / NCP initialization packet.

Inter-character delay:   some devices are slow in processing characters so we need to wait some milliseconds between each of them (e.g. sending AT is equal to send 'A', wait few milliseconds, send 'T', wait few milliseconds, etc.)

LCP compatibility:  it is an option to force the PPP-LCP negotiation,  you need to enable this option only in extremely rare cases

Blackberry compatibility:  enable this option if you are connecting a Blackberry phone as modem

Bluetooth Insecure Socket:  enable this option only if you get issues with the bluetooth connection

DUN service channel:  represents the channel for the bluetooth DUN profile;  change the value and set a number like 2, 3 , 4 or 6 if the connection doesn't work with the default value 0 (auto-assigned)

Access Point:   while BlueDUN doesn't need any particular configuration because it routes the data packets to/from the Mobile 3G or Wi-Fi existing connections, for your phone to connect over GPRS, you'll need to tell the phone which APN (Access Point Name) to use.  
GPRS is a service supplied by mobile phone network operators and the APN is used to work out where to route data requests.  Most operators have different access points for different services, and you'll need to pick the right one, or things won't work; generally the Internet Access point is used for web browsing, email and instant messaging, etc.    Here is the World's GPRS APN list.
For CDMA (Code Division Multiple Access) connections keep the Access Point value blank.

Phone Number:   GPRS doesn't use a dial-up number (as GSM data calls do), but a conventional dial up Phone Number (*99# , *99***1# or something similar) should be set for the modem negotiation.
For CDMA usually the number is #777.

Authentication:   the authentication step is generally required even if the username and password are not defined, so you may select the authentication type = PAP (default) or CHAP.   UserName and Password are sometimes required by certain mobile operators and you have to insert the right ones for the user authentication (otherwise leave them blank).

DNS:  finally, you may need to set the Primary and alternative (Secondary) DNS addresses; they are used to resolve the domain names and are generally assigned automatically during the connection setup when equal to  If you force these parameters it is possible that the service provider cannot resolve the internet URLs and the connection doesn't work.

Note:  dialing and connection is supported by the wireless service provider and extra fees or additional charges might apply as this is going through the carrier's network.

BlueVPN has been tested with BlackBerry 9300, Nokia phones (E65, E66, N8-00 Belle, C60-01), Samsung SGH-L760.

Log reports:

You can help the app development in these way:
1. Open the BlueVPN settings and activate the options "Enable Logger" + "Log To File"
2. Go back and tap the GPRS phone name on the paired device list (start new connection)
3. If connection fails or after some time, open the BlueVPN settings again and click the last item [Send Files for Debug] for sending all the generated log files ( named application.log ) by email

Known issues:

A) The BlueVPN app seems locked on Modem or LCP negotiation messages

1. Pair the GPRS phone with a Windows PC and create a bluetooth modem connection
2. Open a command prompt on Window PC (cmd) and type in the order the following commands:
  • netsh
  • ras
  • set tracing PPP enable
3. Connect to internet the PC with your GPRS phone
4. Send by mail the file  /Windows/tracing/PPP.log  and the application.log (generated as described above)

B) The BlueVPN app shows the connected message (and the stop button) but suddently goes back to the paired device list

Some Android device manufacturers (Sony  for example) do not include the
VPN TUN module in the Android 4.0.x version that is installed on the device. This module is similar to a device driver. Without the module installed, a VPN tunnel cannot be established from the device.
To check if your device supports the VPN you can install the CatLog - Logcat Reader! app;
In case of unsupported VPN, an error message that appears similar to the following example is written to the catlog report when you tap the connection button on BlueVPN app:

E/VpnJni  (  189): Cannot allocate TUN: Bad file number
E/F5EdgeClient( 1391): Failed to establish VPN
E/F5EdgeClient( 1391): java.lang.IllegalStateException: Cannot create interface

You can install the TUN module by installing the "TUN.ko Installer" app:

Please contact the manufacturer's support for more information.

Best Practices:  Use only letters and numbers for Bluetooth device names (no special chars or spaces)

C) After the upgrade to Android 4.1 or 4.2 (Jelly Bean), BlueVPN doesn't connect when click on remote device name

  - remove the pairing with the remote device on Android settings and create it again.
  - click over the icon on the right of paired device name
  - enable the option "Use for internet access" (don't worry if the it remains unchecked )

Sunday, May 20, 2012

Bluetooth tethering for Android devices: making BlueVPN and BlueDUN work together

The BlueVPN application for Android acts like a "reverse bluetooth DUN" feature, or in other terms it is able to open a dial up connection on a bluetooth-enabled cell phone and use it as modem.  This function is natively supported for many operating systems (Windows, Mac OS, Linux ...) but not for Android:  the previous post showed how to create a modem internet connection on Windows 7.    At the current state, the only way to route all network traffic to a custom channel for a "not rooted" Android device is to open a VPN connection.  This is the reason for the application name.

What does mean "tethering"?

For people that are not familiar with the tethering concept, I quote here a definition taken from wikipedia:

"Tethering means sharing the Internet connection of an Internet-capable mobile phone or internet tablet with other devices. This sharing can be offered over a wireless LAN (Wi-Fi), over Bluetooth, or by a physical connection using a (USB) cable . In the case of tethering over wireless LAN, the feature may be branded as a mobile hotspot. The Internet-connected mobile phone acts as a portable router when providing tethering services to others."

While the Wi-Fi and USB tethering has been disabled on some Android devices the Bluetooth tethering is not supported in any case.  These features can be reenabled only by a device 'rooting' (hack the firmware to attain the superuser access) and there are several applications that work fine for rooted devices.
Anyway not all users are willing to alter the original manufacturer firmware because this operation does come with some risks.   The most notable risk is that you will void any warranty that you have on your device and you may have difficulty to find the original ROM for your device.
In addition, some users can run into problems, for example rendering the phone completely non-functional, having problems with reboots (endless boot cycles) or making the device more vulnerably respect to virus attacks.
The main benefit of using Bluetooth or Wi-Fi instead of a USB cable for tethering is that you can keep your cell phone in your bag or pocket and still make the connection.   Moreover, Bluetooth uses less energy respect to Wi-Fi and it is better suited for use in small portable electronics that rely on battery power.
This is because a Wi-Fi device is constantly transmitting data back and forth between connections, and it needs a lot of energy to transmit large amounts of data. Bluetooth, on the other hand, keeps a connection with very little energy being spent, about one-fifth that of a Wi-Fi connection.

The BlueVPN, app works also for "not rooted" devices ad allows to connect on-line an Android device without an Internet-access capability, sharing the connection available on another phone or tablet.

A said before, this application, routes the network traffic to a VPN connection and finally it exchanges the data packets throught the bluetooth channel.    VPN connections are fully supported  on the latest Android versions Ice Cream Sandwich 4.0.x but limited for previuos releases (Girgerbread 2.x and Honeycomb 3.x)

BlueVPN for Android 2.x and 3.x is quite unstable and difficult to set-up

while the version for Android 4.0.x (BlueVPN ics) is more simple and reliable

In this post we will see how to pair two Android devices for bluetooth tethering:  on the second device (host-router) we install the BlueDUN app to enable the bluetooth DUN profile [generally not natively supported].

1. Create the BT pairing between the client device (with BlueVPN installed) and the host device

Settings / Wireless and Network / Bluetooth settings / Turn on bluetooth if off and make the device visible on both / Scan for devices;  when the name of the other device appears in the bottom list, click on it ( maybe you need to insert a paring code, for example 1234 ) and confirm.   Insert the same code, if necessary, on the host device and confirm.

2. Make sure you have a valid internet connection and the BT-DUN profile on host; if necessary install the BlueDUN app.

[ 3. Create a new VPN L2TP connection on client device - only for Android 2.x and 3.x ]

Settings Wireless and Network / VPN settings / Add VPN / Add L2TP VPN  

set VPN name = BlueVPN   and the VPN server = ; disable the L2TP secret and leave empty the DNS search domains parameter.

Normal use:
[ 0. Enable the wifi/mobile data connection on client (required only to allow the VPN connection opening, but not used for data transfers) - only for Android 2.x and 3.x ]

This is a limitation of Android 2.x and 3.x: even if the VPN is enabled, the traffic is not routed toward it if the wireless connectivity is down.

1. Activate the bluetooth interface [if BT DUN profile is natively supported] or open the BlueDUN app on host device and start the service.

2. Open the BlueVPN app on client, click the host name in the BT device list

On Android ICS devices, the first time you click a button in the list, you may get a message that asks to confirm the VPN connection creation.   Check "I trust this application" and confirm; that click again the host device name on the device list. 

at  this point, the application tries to open the bluetooth connection with the host device and open the VPN  called "BlueVPN" to route the network traffic.

if everything goes right, you should see the stop button and the message "BlueVPN connected with ...."; otherwise, click on the animated central image to go back to the main menu. 

The VPN is really connected only if you can see on the notification panel a "key" icon and the traffic statistics by clicking on it (please dont disconnect the VPN direclty from here, but click the stop button when you have finished).

If BlueVPN does not connect automatically (Honeycomb), start it manually from the system settings (set any username and password):

Settings Wireless and Network / VPN settings / BlueVPN

While BlueVPN is connected you can open a browser and navigate the internet throught the bluetooth tethering.

Saturday, May 5, 2012

BlueDUN: Connect Windows 7 PCs to internet via bluetooth through Android phones

This post shows how to install and configure Bluetooth and pair your computer with an Android mobile phone to enable the internet connection.

Prerequisites are that you have already installed the bluetooth adapter on your windows 7 computer and turned on the bluetooth interface.

The pairing process can be started both from computer and phone. If you choose to start from phone you need also to enable in the Bluetooth Settings  the option: "Allow Bluetooth devices to find this computer".
In this example, I will choose to start the pairing from your computer.

In the notification area, click on the small arrow to reveal a whole set of additional icons. Then, right click on the Bluetooth icon and click on "Show Bluetooth Devices"

Now you can see the list of the previously paired devices, but, before clicking "Add a device" to create a new pairing with your phone it is necessary to turn on the BlueDUN service on phone.

Open the BlueDUN app and enable the "Discoverable" option on preference panel (click the menu button to access to the preferences); now when you start the service you should get the message "Bluetooth permission request" asking you to enable the bluetooth visibility status for a limited time. 

If the BlueDUN service is running on the phone, you can click the "Add a device" button on PC; this starts the "Add a Device" wizard, which automatically scans for new devices, including Bluetooth ones.
After a few seconds, your phone should show up in the list of available devices. If it doesn’t, then you need to make sure Bluetooth is enabled on the phone and the phone is set as discoverable.

Select your phone and click Next.

The wizard displays a code that you need to type on your mobile phone, so that the pairing is completed.

On your mobile phone, you are notified that your computer wants to connect via Bluetooth. Press OK, then type the code.   Once the code is entered, the pairing is created and Windows automatically searches for drivers for all Bluetooth profiles available on your mobile phone, then installs them.

To check the discovered and installed BT profiles, you can right-click the phone you’ve just added and choose Properties:

Note:  the "Dial Up Network (
DUN)" profile will be available on phone only when the BlueDUN service is running; if you pair the devices in a different condition, you will not be able the create a new internet connection on PC.   In this case, remove the old pairing and create a new one following the above steps.

Make sure the DUN profile is also selected and click OK to confirm.
Now it is the time to create a new internet connection to access the internet throught the  bluetooth phone tethering:  right-click again your phone and then choose "Dial-Up Networking" > "Create a dial-up connection…"

after clicking that, it will ask for what Modem device to use in your dial-up choose the last one, if it doesn’t work, try the others...

now enter the mandatory dial-up number ( for example  *99***1#  is the mostly used ), and enter a name for your dial-up connection… no need for username and password with the BlueDUN app …

after entering the details, click Connect, it will try to dial the number in your phone and registering your connection to networks server, and after that it will test your connection…

On the BlueDUN app you should see the "Modem negotiating.." message and soon after the panel with connection statistics indicating the connection was established with success.

Now your done! Click close button to close the window, and Open your browser to start surfing the web, Enjoy!


Saturday, April 7, 2012

BlueDUN+: MB Comand OnLine and Android phones

The bluetooth pairing between Android phones and the MB comand online allows the users to share phone contacts and perform telephone calls.  In addition to Navi(gation), Audio, Tel(ephone), Video and System menu-options, you can see another icon:  the web navigation.  
Selecting this menu option, the user can open a web browser and insert URL for web navigation, or access the Comand OnLine functions including weather forecast, facebook, point of interest and more... 

The comand online needs a bluetooth DUN (dial up network) service but Android phones don't support it natively (because it is an old technology), so you have to install an app to activate this service.

The BlueDUN app for Android enables the bluetooth DUN service on your phones; this short guide shows how it is possible to open the web access for MB Comand OnLine:

1. Remove the old pairing between the Navi and the phone
If you have not recently purchased your car, it is quite possible that you have already paired the phone with the Comand to make phone calls.  When you create the Bluetooth 
connection between two devices, each of them searches and stores all the services available on the other device, then when you try to open a web link you may get the message  "Connected phone does not support data communication".   

No problem, it is normal, you have just to return to the initial situation, like if the two devices had never met themselves.  In other words, you have to remove the pairing:   select the Tel menu option / Telephone item on the bottom sub-menu / Bluetooth telephones / scroll the phone list and select the phone to remove / click the white icon on the right / De-authorise option and finally confirm.

2. Open BlueDUN,  Start the DUN Service and create a new pairing

After removing the pairing you'll need to create a new connection between the phone and Comand: normally you should activate the bluetooth interface on your phone and make it discoverable by other devices.  The BlueDUN app automatically enables the bluetooth, but you must check the "Discoverable" option in the properties panel (click the menu/left hard-button to show it):

BlueDUN requires a valid internet connection to start, so, when you click the "Start Service" button, the first message you can see is "Testing Internet connection...".   The app emulates a modem features but it doesn't perform a true dial up call, when the device client requests information, BlueDUN forwards these messages to the wifi or mobile (HSDPA/EDGE/GPRS) data connection and it forwards back to the client all replies.

If the BlueDUN screen shows the status "Waiting Bt Client.."  you are ready to pair again the Comand and the phone following the same steps:   select the Tel menu option / Telephone item on the bottom sub-menu / Bluetooth telephones / search for discoverable devices.

3. Select a Provider and setup the connection parameters
Once the Comand has stored the phone BT services, including the DUN, you don't need to pair them again, but the first time you try to open a web link you will get this message:  "No provider selected or provider data is incorrect. Please check settings".      You need to assign a Provider for the web connection and you can choose one from provider list of your country.

Connection parameters (Phone number, access point, used ID and Password) are not important, so don't care about them.  The only parameter that has effect is the DNS address:  if you enter a wrong IP you may not be able to access the MB server, so it is better to leave them as automatic assigned.  In this case BlueDUN will use the Google's default primary DNS IP (8:8:8:8) and secondary DNS IP (8:8:4:4).

4. Access to Comand OnLine Apps or to a web page
Previous steps should be executed only the first time, in normal usage you can select the web navigation icon and open an URL or the Mercedes Benz Apps menu.

It is important to notice that Comand OnLine doesn't access directly to internet web pages but downloads them from the Mercedes Berz VPN server, this means that download speed is considerably slower respect to the phone browser because it depends on MB server congestion.

I suggest to use the phone connected to a Wi-fi network (such as the home or office wifi access point) when you use the Comand Online the first time for accessing the on-line services:   the navigator gets from the server many data for configuring the menu and the apps and the phone must have a stable connection otherwise you need to restart the process again if the connection drops.

Moreover, you have to remember to start the BlueDUN service on the phone before opening a www link, otherwise you will get the message "Function not possible at the moment".   For this reason, you may activate the "Auto-Start" (and "Auto-Resume") option on BlueDUN property panel;  in this manner the DUN service will be always on while the app is running.

If after several attempts, you can not connect, always getting the message "Connection failed" message, it means that bluetooth channel cannot be reused. 
Try closing the connection by clicking the disconnect icon at the bottom right on the Comand, turn off the bluetooth interface on the phone and finally restart the BlueDUN service.

In the preference panel you may also change the Bluetooth Channel:   the default is number 0 [auto-assigned], but if it seems that you cannot start the bluetooth DUN service, enter a value in the range 1-30.  Generally this has not effect for new version of Android because the DUN channel is always auto-assigned.

Another parameter very important for the connection success is the UDP packet delay;  this parameter represents the time delay between each packet sent to the UDP server.  Its default value is 50ms but you can increment it (for example set 100ms or 150ms) if the phone has connection issues.   [Deprecated on new versions]

If none of the previous actions has success, please enable the "UDP Compatibility" option in the property panel, this option increases the connetion timeout and reduces the download speed, but allows the Comand to connect online.  [Deprecated on new versions]