Damian's Blog .NET from Geneva, Switzerland

26May/119

How to: Windows 7 incoming VPN from Android

A couple of weeks ago I tried to get my HTC Incredible S, running Gingerbread to connect via VPN to my Windows 7 box.  I failed, but today I succeeded.  This is how.

I created the incoming VPN on Windows 7 by following instructions I found on the web:

Open the Network and Sharing Center

image

Click on Change Adapter Settings

image

Press Alt-F, and select New Incoming Connection

image

Configure the incoming connection

imageimageimage

Change the IPV4 properties to specify a DHCP range

Make sure the range you specify is on your LAN, and out of the range served by your DHCP server (you can updated your DHCP server to exclude this range).

image

Check the firewall

I went to Advanced Settings under Windows Firewall, clicked on Inbound Rules, clicked on the Local Port column to sort by that column, and then verified that the line for port 1723 was set up and enabled (Routing and Remote Access (PPTP-In).

image

Set up port forwarding

I then went to my Router configuration, and set up port forwarding, so that external connections to port 1723 were forwarded to the machine I just configured (which is always allocated the same IP address by the router):

image

Now my Android device can connect to my internal VPN using the default settings.  You’ll need to know your external IP address.  You can find it using tools like http://www.whatismyip.com/ but it may change.  I have mine set up using http://www.dyndns.com/

Filed under: Android 9 Comments
18Jul/100

Tilt to turn pages in Kindle Android: Nope!

I bought an HTC Desire Android mobile phone a couple of months ago.

When I first got it, there were two applications that were missing that I really really wanted: Audible and Kindle.

image

Both were recently released, and despite this, my life is in fact not now complete.  There must be some other app for that.

I’ve been thinking about what I could develop.

As I read using the Kindle app the screen becomes smudged with my tapping the screen to change the page, and I thought it would be nice if I could change pages by tilting the phone to the right in a quick nudge.

I defied the temptation to start coding, and did some research.  It looks like it isn’t possible to do what I want using the public SDK, and to save myself the pain of rediscovering why in six months, when I have forgotten, here are some notes.

For this to work I’d need three things: A background process (called a service on Android), a way for it to detect when the phone has been tilted, and a way for it to tell the Kindle App to change the page, when it is running.

Creating a background process is pretty straightforward, and there is a sensor API that can be used to detect when the phone has been tilted.

Telling Kindle to change the page isn’t so easy.  I thought I’d found it when I discovered the IWindowManager.injectPointerEvent method, but I quickly found that this was not part of the documented Android API, and using it would be very very bad.

I was left with trying to find out whether the Kindle App itself had any way for other apps to tell it to change page.  The standard way of doing this would be to expose an Intent which other apps could invoke.

Unfortunately by dumping the Kindle App’s manifest from its installation (APK) file, it looks as though the only intents exposed are the standard MAIN, LAUNCHER, VIEW, DEFAULT and BROWSABLE intents.

Game over, unless I’m willing to go beyond the public API, which I’m not, right now at least.  Unless anyone else has any ideas?