Try PandaPow for Android
By date:

RSS Feed

Skip this one

Setting up VPN on Android, or any smart phone for that matter, can be a bit of a pain. It's not ideal having to manually type all the info needed for setting up VPN on the phone. It is easy to make a mistake when typing, which can lead to severe headaches trying to trouble shoot the problem. If you have several accounts to set up, or several phones to configure, then it can become quite a project.

The following short guide shows how to use the import feature of the 1 VPN app to make it easier to set up VPN. The import function lets you import one or more VPN configurations from a file or email. This feature is also useful for backup and restore of your VPN settings. The 1 VPN app can be bought from the Android market or from the app developers website http://doandroids.com/Apps/OneVpn/.

Step 1.

Lets assume we are setting up a PPTP connection, then the first thing to do is to send the following text in an email from your computer to your Android phone:

PPTP; My VPN; username; password; vpn.myserver.com; ; true

Naturally you should replace 'username', 'password' and 'vpn.myserver.com' with something which is appropriate for your particular VPN server. Also, if you don't want encryption, you should replace 'true' above, with 'false'. You may also want to leave the password empty, for security reasons, in which case you will have to fill it in later when you connect to the VPN.

Step 2

Open the email you just sent on your Android phone using the Gmail client, and copy the text to the clip board. To copy text from an email you need to press "Menu>More>Select Text", then select the text to be copied by dragging your finger across it.

Step 3

Open the 1 VPN app, and click the "Add". On the following screen click "Import profiles" (the last option). This will bring up the Import Wizard seen below. Next you click "From Clip board", which imports your set-up and shows the list of profiles just inported (in this case only 'My VPN'). Click OK and you're done.

Imported Profile

Confirm Import

Import Wizard

More

The 1 VPN app makes it easier to use VPN on Android, with the import function being one of its handy features. There is also an export function which lets you backup your VPN set-ups, or copy it to other phones.

To learn more about the import/export features of 1 VPN on Android, you can look at: http://doandroids.com/Apps/OneVpn/how-to/import/.

The main time saver of 1 VPN is its unique 1-click connect feature. To learn more about 1 VPN visit http://doandroids.com/Apps/OneVpn/faq/.

Skip this one

Frequently reoccurring svn task is: add an existing source tree as a new project in a svn-repository. Here's how I do it:

# done once and for all, this creates a template I use for all my svn-projects
mkdir ~/svn/project_template
mkdir ~/svn/project_template/trunk
mkdir ~/svn/project_template/tags
mkdir ~/svn/project_template/branches

# done only if you want a new repository (which may contain several projects) 
svnadmin create /path/to/repository 

# next, create a new empty project, called NewProject, by importing the template:
svn import -m "new app" ~/svn/project_template file:///path/to/repository/NewProject 

# Next, cd to the parent of the new source directry, i.e. 'NewSourceDir' below should contain
# all files and directories you want to add to the trunk-directory of the svn-project. Next do:
svn co file:///path/to/repository/NewProject/trunk NewSourceDir 
# this turns the NewSourceDir to working copy of trunk,
# but it doesn't add any of its content.
# So now it is time to start adding the stuff:
cd NewSourceDir
svn add X Y ...
# and finally a commit:
svn ci

This is my preferred way of doing it since it lets me add the new stuff selectively. Rather than using 'svn import' to add everything at once, in which case I would first have to create a 'clean' copy of the new source. Hmm, i'm gonna put the above in a script so that I don't ever have to look at this post again :)

Just a note on svn add. Default when add is applied to a directory is to add all its content recursively. To add only part of the content, use the --depth flag. That is:

svn add --depth=empty NewDir

adds an empty NewDir to the reporitory.

svn add --depth=files NewDir

adds NewDir and all files it contains, but leaves out directories.

svn add --depth=immediates NewDir

adds NewDir and all files and directories it contains, but not recursively.

Here's a link to another svn cheatsheet which covers some other tasks.

Skip this one

It's the second time I bumped into this issue now. This time it was a preference screen, so I didn't realize it was the same problem as with a ListView in general. The short story is: if you want a ListView with a transparent background you need to add either:

android:cacheColorHint="#0000"

in the xml-declaration of it, or something like:

ListView v = getListView();
v.setCacheColorHint(0);

in code somewhere. If you're dealing with a preference activity, as was the case for me this time, then you can add the latter in your onCreate after inflating the preferences from xml.

If you don't do this, the list background will turn black (or whatever default is given by the theme used) during scrolling.

If you want to know more, here is the full story on list backgrounds

Skip this one

The IntentService class is handy indeed. It's a service that spawns a separate thread for the work it does. All you need to do to use it is to extend it, override the onHandleIntent method, and then call startService to invoke it. E.g. something like this:

public class MyIntentService extends IntentService {
    protected void onHandleIntent(Intent intent) {
      // do some work
    }
 }

 public class MyActivity extends Activity {
    ...
    void startMyService() {
       Intent i = new Intent(this, MyActivity.class);
       // The work will be done in a separate thread, so it doesn't block
       // this activity
       startService(i);
    }
 }

At least that's what the current doc about IntentService says. There's one more important thing to know though: the MyIntentService has to a default constructor, that takes no arguments, e.g. as so:

    MyIntentService() {
         super("MyIntentServiceName");
    }

The system expects there to be such a constructor, and if it is missing you will get a InstantiationException when startService is called (if there's no constructor at all you will get a compilation error).

The string passed to super above is arbitrary, and I can't really say I know what it is used for. It is needed since the only constructor exposed by IntentService takes a String argument.

Enjoy using your IntentServices.

Page 1 | Next Page