Kategorien
Android Computer / Informatik

Backward Compatible Android Programming

Hey everybody,

i just wanted to share my way of making Android apps backwards compatible with older Android versions.

In my case i have the „App Update Notifier“ app. Basically it checks your installed apps for available updates. Therefore it queries the Android Market (via Android Market API). To be able to do this one has to provide a valid google account login. On Android 2.x devices there is the AccountManager class that you can query for the phone’s account information and use this information. This way the user doesn’t have to provide his login details again for your app. He just needs to accept once that your app might use his login details. But this feature is not available on Android 1.x. So the user has to provide valid google login details in the settings of my app. Because of that there were two versions of „App Update Notifier“ in the Android Market at the beginning. „App Update Notifier (for 1.x)“ and „App Update Notifier (for 2.x)“.

But then i thought of a way to make both functionalities available in one app. So i had to think of a way to check whether AccountManager is available on the current device or not. So i came up with using Java Reflection. I wrote this simple function:
[sourcecode language=“java“]
public static boolean classAvailable(String name) {
try {
Class.forName(name);
return true;
} catch (ClassNotFoundException e) {
return false;
}
}
[/sourcecode]

It just tries to get the Class information for the given class and returns true if it exists and false if it’s not present in the current Android version.
This way it is easy to destinguish between the two versions. For example in my settings activity i have two possible layouts – the one where the user needs to enter his login details and the one where he doesn’t because they are provided through the AccountManager.

[sourcecode language=“java“]
if (classAvailable(„android.accounts.AccountManager“)) {
addPreferencesFromResource(R.xml.settingsscreen_2x);
} else {
addPreferencesFromResource(R.xml.settingsscreen_1x);
}
[/sourcecode]

This way you can check if a class you want to use is available on the device. But now you have a problem. The compiled DEX file contains stuff that might not exist on the current device. Android will then throw a VerifyException when it’s loading the DEX file. Now you have two options: use Reflection only to call your stuff (which is ok when only have to call a single method or so) or you need to seperate the code for different Android versions. So you only have supported references in you invoked dex file. For example i have a class with the AccountManager implementation called Helper2x and a class with the old way called Helper1x. This way on an Android 1.x device, the Helper2x DEX file will never be loaded and therefore will not throw an exception.

Hope that helps many of you to make their app better backwards compatible.
Gr33tz Goddchen
[ad]
Kategorien
Android Computer / Informatik

Android Developer Console – Comments visible

Hey everybody,
i’ve just noticed that android developers can now view the comments on their apps in the developer console 🙂 That’s really great, thx Google 😀

[ad]

Kategorien
Android

App Update Notifier

Hey everybody,

„App Update Notifier“ is now available in the market. There are two versions. One is for Android 1.5 and 1.6 devices. You have to provide your username and password in the settings. The other one is for Android 2.0 and above. It makes use of the AccountManager, so u don’t have to provide any login information.

„App Update Notifier“ notifies you about updates for your installed apps. It has a background service for update notification as well as a GUI to check manually.

Go check it out. Just search the market for „Goddchen“ or „App Update Notifier“. Or have a look at the two appbrain links:

Gr33tz Goddchen

Kategorien
Computer / Informatik

Google dreht auf – Sprachsuche und Maps Navigation in Deutschland für Android

Hey,

also heute gehts richtig ab 🙂

Google hat die „Sprachesuche“ im Android Market für Deutschland freigeschalten. Erste Tests funktionierten bei mir einwandfrei 😀

Zusätzlich funktioniert seit heute die schon länger in der Maps App vorhandene Navigations-Funktion. Einfach eine Route eingeben und Live losnavigieren. Einfach Spitze 😀

Danke Google.

Gruß, Martin

Kategorien
Computer / Informatik

Barcamp Bodensee 2010 – Android Favourite Apps Session

Hey, here is the list of apps that were mentioned in the „Android Favourite Apps“  session on Barcamp Bodensee 2010.

  • AppBrain Market App
  • Centr
  • Google Buzz
  • Foursquare
  • Wikitude World Browser
  • Layar Reality Browser
  • Aloqa
  • Block Chalk
  • Twitter
  • Seesmic
  • Tweetcaster
  • DB Rail Navigator
  • Inserty
  • Evernote
  • Barcode Scanner
  • MagicMarker
  • Android Bash
  • Advanced Task Killer
  • Battery Indicator
  • CallTrack
  • Dropbox
  • DasTelefonbuch
  • Facebook
  • Handcent SMS
  • Last.fm
  • My Tracks
  • NetCounter
  • Endomondo
  • Speedometer
  • Backgrounds
  • Phonalyzr
  • NewsRob
  • UStream Broadcaster
  • Blinkendroid
Kategorien
Computer / Informatik

Android Development

Seit ein paar Tagen hab ich meine ersten beiden Apps im Android Market.

  • Mensaplan Konstanz
  • Android Bash

Mehr Infos dazu gibt auf meiner Android Development Seite.

Gruß, Martin

Kategorien
Computer / Informatik

Motorola Milestone Update 2.1 (with root)

Hey,

wir haben’s mal wieder geschafft 😀 Hier ist das 2.1 Update (1.14.0 DACH -> 2.28.0 DACH) für DACH Milestones – incl. Root-Patch.

Warnung: Flashen geschieht auf eigene Gefahr! Das verwendete Build ist ein Test-Build.

Das Ganze wurde möglich gemacht durch SeraphimSerapis und mir 😀

Gr33tz, Goddchen

Kategorien
Computer / Informatik

Working VPN/PPTP with MPPE encryption on Motorola Milestone – Android 2.0 (2.0.1)

Hey everybody,

i think many of you know the problem with android 2.x phones: they can’t connect to pptp vpn servers which have encryption enabled.

You get the error:

E/pppd ( 6070): unrecognized option ‚+mppe‘

But since yesterday this problem is solved 🙂 I had a similar idea for a while now but didn’t have the time to try it. As the error message states „pppd“ is missing the +mppe feature. So, why not just compile it WITH the mppe feature and replace the original binary. And guess what: a guy „qvr“ at Alldroid (http://alldroid.org/threads/15944-VPN-PPTP-modules-needed) just did exactly that. And now guess again: IT’S WORKING JUST FINE 🙂

Now i got vpn working at my university 🙂 Thank you so much qvr!

Just go the alldroid posting and follow the link to his binaries. I just backed up the original files and replaced them with qvr’s. Everything with the Root-Explorer (of course, you need root to do that!).

Greets, Goddchen

Kategorien
Computer / Informatik

Gesture Search for Motorola Milestone

Hey everybody,

today i read that google is introducing gesture search for american Android devices with Android 2.0 and higher. So i thought: why only for american phones?

A quick google search brought me to this xda-developers thread where „Firerat“ posted the apk he got from the market.

Just download to your SD card and install as any other app. Works perfectly on my Milestone (Android 2.0.1) 🙂

Greets, Goddchen

Kategorien
Allgemein Computer / Informatik

Motorola Milestone – Android 2.1 Update Plan

Hey,

Motorola released a news regarding the update plans for Android 2.1 on the Motorola Droid, Milestone, Cliq and Dext.

Have a look here:

https://supportforums.motorola.com/community/manager/softwareupgrades

If this is correct we (European Milestone users) will get the update within the next six weeks. That would be really great! 🙂

Greets, Goddchen