Planet Android

January 22, 2010

Android Developer Labs World Tour

Late last year, we held a series of developer labs to give you a chance to ask questions and play with some new hardware. One of the most common questions we received was, "When are you going to visit my city?" It's a good question, and we're pleased to answer it today.

The Android team is embarking on a world tour, which will include cities in Europe, North America, and Asia.

At each stop, we'll be delivering an update on the state of the Android platform—including a look at the latest Android hardware. It's a great opportunity to meet like-minded Android app developers, play with the latest Android devices, test your apps, and ask Android team members any questions you might have. You can find out more on the Android Developer Lab site.

Here's the line-up of Android Developer Lab locations for February and March 2010:

North America

  • Austin, Texas – Feb 4
  • Seattle, Washington – Feb 8
  • Waterloo, Ontario, Canada – Feb 8
  • Washington, D.C. – Feb 9
  • Mountain View, California – Feb 10
  • Cambridge, Massachusetts – Feb 11
  • New York, New York – Feb 12

Europe

  • London, UK – Feb 2
  • Paris, France – Feb 8
  • Berlin, Germany – Feb 10
  • Zurich, Switzerland – Feb 13
  • Madrid, Spain – Feb 13

Asia

  • Singapore – Feb 28
  • Taipei, Taiwan – March 3
  • Hong Kong – March 4

If you'd like to attend, you'll need to request a spot by February 1st. Space is limited, so please wait for an email to confirm that you have a spot in the lab.

While we're on the road, we're also going to stop by and speak at the following local Android user groups:

  • Stockholm, Sweden – Feb 4
  • London, UK – Feb 5
  • Chicago, Illinois, USA – Feb 6

We're looking forward to meeting you in person!

by Reto Meier ([email protected]) at January 22, 2010 11:21 PM

Bizarre myTouch 3G / HTC Magic hardware update with 3.5mm headphone jack spotted

The HTC Magic is a great Android phone, and yes, we’re guilty of favouritism here because there’s one sitting beside us on its second battery charge of the day and we’re locked into an 18-month Vodafone contract so can’t afford to “fall out” with it.

But what the Magic AKA myTouch 3G really lacked was a 3.5mm headphone jack, relying instead on a cumbersome proprietary adaptor that added unnecessary bulk to the slimline little touchscreen phone. But now it has one, courtesy of what appears to be an all-white version of the laughably silly Fender Edition myTouch 3G.

my-touch-3G-headphone

No idea why HTC and T-Mobile would bother refreshing the spec of an already quite old (in mobile phone years) Android phone, when there are numerous other newer and often cheaper models out there. But still – if the phone’s still considered “new” in the eyes of operators, hopefully it ups the chances of it getting an update to Android 2.0 or 2.1 or 2.0.1 or whatever in the future.

Pics via MobileCrunch and TMoNews.

by EURODROID 00001 at January 22, 2010 10:44 PM

Google bribing game developers with free Nexus Ones at GDC 2010

Google is reported to be handing out “thousands” of free Nexus Ones to registered attendees of this year’s Game Developer’s Conference, the highbrow yearly meet of the finest game makers on the planet, with the aim being pretty transparent – to shore-up Android’s rather dubious Games channel.

Here’s what the Android Developer’s blog has to say about this blatant bribery attempt:

“But that’s not all. Google and GDC will also be providing complimentary Android phones to attendees who register for All Access or Tutorials and Summits passes by the Early Bird deadline of February 4, 2010. Qualified attendees will receive either a Nexus One or a Verizon Droid by Motorola, so they can quickly apply what they learn from the various Android sessions. You can find more details about the Android phone offer on the GDC site.”

Look, see some of the IMPORTANT PEOPLE that will be there this year…

gdc-nexus-one

Now, since we’ve recently started reviewing Android games, we’ve actually been pleasantly surprised about the small number of gems (hey, we’ve found six we like so far!) to be found, mostly either for free or a minuscule amount of money.

But a successful GDC meet-greet-and-bribe for Google could take it to another level – GDC is where Electronic Arts hangs out. That’s where Epic and Microsoft hang out. Someone will probably even let SEGA in. If Google can get the gaming elite on its side, it’ll seriously change the game.

google gdc

And if you’re American and think the DROID is an aspirational piece of hardware, you can have one of them if you’d prefer to help keep Motorola sweet. Above pic via MobileCrunch.

by EURODROID 00001 at January 22, 2010 10:29 PM

Aspiro launching its streaming music service on Android, in Europe

Aspiro, a European mobile entertainment group who we’ve never heard of before right now this very minute, has said it’s launching an Android music streaming app across Northern Europe. That’ll be nice, won’t it?

Here’s how Aspiro explained its new WiMP-based service in today’s press release:

“Millions of tracks are already available on the player from some 160,000 albums and more than 120,000 artists from thousands of record labels including global giants such as Universal, Sony BMG, EMI and Warner as well as a host of local companies.

“All the key features of the WiMP desktop service are available on the Android version – such as search, playlists, favourites and discovery. Tracks can also be cached for offline listening.”

aspiro logo android

Sadly, nothing’s coming up under a search for “Aspiro” on the UK Android Market as of 22.12 on Friday January 22, though. And it is yet to hit the Market content scraper directories, so we can only assume it’s not quite launched yet.

by EURODROID 00001 at January 22, 2010 10:17 PM

Android Gamers Play

Google offering free Android phones to gamers at the 2010 Game Developers Conference may help drive gamers to Android but maybe not as much as Apple’s new application removal policy.

Google will provide a free Nexus One or Droid to those that register for an All Access or Tutorials and Summits passes by the Early Bird deadline at the 2010 Game Developers Conference, which is smart so as to encourage more games to be produced for Android since 7 out of the top 10 Android applications are games.

What I think will further drive game developers to Android is Apple’s new policy of AUTOMATICALLY removing your application from the App Store if a competitor issues a formal complaint.

This happened recently with AppVault Pro being removed from the App Store due simply to the request of AllAboutApps, who developed AppBox Pro.

Now there should be some copyright protection and copycat protection, but this didn’t seem to be the case.

The way Apple handled this without investigating and simply pulling the app should dissuade developers from the dictation of Apple to the more openly handled Android Market plus the other Android application distribution systems.

This should make developers like Ray Wenderlich at App Vault think more about concentrating on or at least divvying their focus toward Android, although free phones does help :)

Android Gamers Play

Post from: Google And Blog


by Michael Martin at January 22, 2010 10:00 PM

Android annihilates iPhone in Myxer Boombox Q4 2009 download data

Another stunning bit of Android Vs iPhone market share analysis has been released today, courtesy of media download (AKA ringtone & wallpaper supplier) Myxer.

According to user data that counts downloads of Myxer products by mobile users, Android phone owners download SEVEN TIMES more digital stuff than iPhone users – and the pace in growth of Android phone access to the site is growing faster than iPhone user numbers to boot. Here’s an actual quote, for truth purposes:

“According to research conducted in the fourth quarter of 2009, Android users download seven times as many ringtones, wallpapers, videos, applications, and games as iPhone users. Correspondingly, visits to Myxer’s mobile site from users on the Android operating system grew 350% in 2009, compared to iPhone, which grew 170%.”

Myxer Android iPhone share

What does this tell us? Probably that Android owners are geeky tinkerers, keen on trying everything on the network – rather than casual iPhone buyers who only bother with the famous few apps Apple shovels down their throats via TV adverts.

But let’s not over-analyse this – the important thing is it’s yet another upward-pointing graph of VICTORY!

by EURODROID 00001 at January 22, 2010 09:44 PM

Android at the 2010 Game Developers Conference

2009 has been a great year for Android Market. With the support of developers like you, Android Market now has more than 20,000 applications. Of these applications, games have proven to be particularly popular with Android users. Seven of the ten most popular paid applications on Android Market are games, so there's a significant opportunity for game developers as the number of Android devices continues to grow at a rapid pace.

To better support this trend, we are increasing our support of Android game development. As a first step, we will be presenting a number of Android sessions at the Game Developers Conference on March 9th and 10th in San Francisco. The sessions will be technical and will include everything you need to know about Android game development in Java or C++. Engineers from the Android team will also be available to answer your questions. Whether you are new to the platform or already have games in development, we would love to meet you face-to-face, answer your questions, and see what you're working on. Be sure to keep checking the GDC site because we'll be adding more sessions.

But that's not all. Google and GDC will also be providing complimentary Android phones to attendees who register for All Access or Tutorials and Summits passes by the Early Bird deadline of February 4, 2010. Qualified attendees will receive either a Nexus One or a Verizon Droid by Motorola, so they can quickly apply what they learn from the various Android sessions. You can find more details about the Android phone offer on the GDC site.

Our goal is to make it as easy as possible to develop awesome games for Android, and this is a first step. Hope to see you at GDC!

by Eric Chu, Android Mobile Platform ([email protected]) at January 22, 2010 07:11 PM

Fandango Movies

Download or upgrade the Fandango app today and we’ll waive the service fee on in-app movie ticket purchases made now through March 7, 2010! Watch trailers, view fan ratings, use the phone’s GPS to find the closest theaters & the movies playing at them. Our super-quick purchasing secures your tickets fast & drama-free!

Price: Free

AndroidTapp.com Android App Review:

Pros & Cons:

Pros

  • Buy movie tickets via mobile app
  • Find movie theaters, showtimes, see trailers and read fan reviews
  • Integration with Fandango.com account

Features:

Fandango Movies Android App brings a similar movies and showtimes experience from Fandango.com to Android phones. You can find movie theaters, showtimes, see trailers and read fan reviews (as the app can be integrated with your Fandango account; i.e. save credit card on file for quicker checkout). This app differentiates itself among other movie and showtime apps by allowing you to buy movie tickets directly within the app.

Fandango Movies Opening This Week Fandango Movies Top Box Office Fandango Movies Near Me Fandango Movies Coming Soon Fandango Movies Detail Fandango Movies Fan Reviews Fandango Movies Showtimes for Buying Fandango Movies Select Ticket Quantity Fandango Movies Enter Credit Card Info Fandango Movies Manually Set Location Fandango Movies My Account Preferences

Usefulness & Ease of Use:

Fandango Movies Android App is useful for just about every Android phone owner who needs to quickly get movie showtimes. Find movies nearest your GPS location, by newest releases, top box office or searching.

Frequently Used:

Frequency of use is dependent on your movie theater outing needs.

Interface:

The user interface is great! Totally optimized for mobile operation; neat, organized and easy to find movies.

AndroidTapp.com Rating

AndroidTapp.com Rating!AndroidTapp.com Rating!AndroidTapp.com Rating!AndroidTapp.com Rating!AndroidTapp.com Rating! (4.3 out of 5)

Should you Download Fandango Movies? Yes! Great way to Find and Buy Movie Tickets on the Go!

by Antonio Wells at January 22, 2010 01:08 PM

Multitouch implementations: Hackers give Nexus One users what Google refuses

Nearly every Android phone that has been released supports multitouch, but Google has refused to implement it throughout the operating system and most of its native apps. Google made the design...

by Taylor Wimberly at January 22, 2010 07:30 AM

January 21, 2010

Discovering Flurry

First, I just want to point that I'm not in any way affiliated with Flurry, and blablahbla.... :
NO I DON'T KNOW THOSE GUYS... I just tried their tool !!


What is Flurry ?
When you launch a new application, it's always great to have some feedbacks on it.
There are many different feedbacks : error reports, user evaluations, user mails, online scores, or... 'some' statistics.
It's useful for two different things :
* for your ego, it's always a good thing to have some feedback that basically says that people are trying your application. It's even better if they say they like it ! Even if you don't have the super-developed ego that most developers have, having this kind of information is good for motivation, and helps you improve your application ! As strange as this point may sound, I think it is really important specially if you are an independant developer, as you will need some motivation !
* It's  also crucial if you want to know who your application users are, and how they use it ! It will let you analyse what is good in your application, what are the weaknesses, where to put your efforts in order to satisfy your users...

As I had embedded AdMob ( the now famous ads provider for Android ), I already had some sort of feedback for a while : the number of ads impression for every day. It gives me an indication on how many users are playing my game, and on how this number is evolving.

Flurry ( actually Flurry Analytics ) gives you a lot more statistics on the users and on how they use your application.

How to integrate Flurry ?
The integration of Flurry is really easy.
Create an account on their web site, register your application, add the jar in your application, and copy paste some code on each activity, and voilà ! your first integration is done !!
I also added some special events, in order to know which activity was started, and which game mode was used ( the game has 6 different game modes ).
This is a very good point with this middleware !!


What indications Flurry provides you ?

Flurry provides you informations on :
* users : how many users you have, whether they keep on using your application, how many times did they use it every day, how many sessions you have, how long is a session, and where do they come from.
* Technical : info on which phone was used, which carrier, which firmware, and a simple error reporter is provided ( that does not seem to interfere with mine !! )
* Events : Events are special signals you put in your applications and that are collected by Flurry. You basically do whatever you want with them !

By the way, the information is nicely presented, with some beautiful graphes that make it easy to get the information quickly !


How useful is this information ?

To be honest, I'm kind of fascinated by all this feedback !
All of it is not useful, but it's really interesting to navigate throw this pages and graphes on my game !

In the user pages, you can see the evolution of the way your application is used : if it keeps on increasing.
For instance, I really did see the Chrismas effect : the number of new users has really increased after the 25 !



Welcome to all of those new Android Owners !!



The technical part is also really interesting :
* The firmware versions are divided in about one big third Android 1.5, another third Android 2.0.1, and another little third is Android 1.6...
The rest ( yes, the rest after the 3 thirds... ) is Android 2.0 and Android 2.1. That means that if you want to bypass one of this Android version, you are limiting your audience in large proportions !








* The devices : The droid is the big winner here, with about 1/3 of the devices used. Then the HTC Hero / Eris, the HTC G1/Dream and the MyTouch/Magic...
We can observe that the french version of my game, obviously mainly played in France shows a very different picture :
WordProspector version ( essentially played in the US )



"Chasseur de mots" ( the french version, essentially played in France )


We can see that Samsung - that had shipped the Galaxy a long time ago in France - is much more present, and that Motorola is surprisingly unpresent !
Another funny thing : in the french version there is a ... BlackBerry 8230 : I guess someone played with home-made OS and changed the Phone_Model string !

Last point : the events
The events can clearly be the most important point in Flurry if you use them wisely.
If you want to know something specific on how your users are using your application, Events are for you !
For instance, in my game, I registered which game mode the player were playing.
Personally, I always play the game in Full Game mode, 1 minute, but I discovered that  most people played in 'simple mode', for 1 minute.


Conclusion :
Clearly, users want some quick game : both 'simple game' and 'full game' are played.
And the 2 minutes and 3 minutes games are far from being negligeable ( at that point, I was still wondering if I had developed that for more than 3 users :)


Conclusion : was it worth it ?

First, I want to point that, obviously, Flurry your application to open network and localization authorizations. I don't think it is a real issue ( and in my case, I already needed these authorizations for AdMob), but it may be something that you don't want.

If you don't mind opening these authorization, and don't have any other way to get feedbacks, I think Flurry is really a choice to consider.
It's so simple to use and gives you lot of information.
Now I regret that it is not more flexible with the information it gives. I would like to have a way to create my own requests. For instance, I would like to know how the firmwares are distributed on the G1, but you don't have that much freedom ( even if there are a lot of information already available ).
A custom system done by myself would be more flexible. But, let's be honest : I won't invest time enough  to have something as elaborate as their tool ! ( not to mention the fact that I don't know how to present the data in such a nice way ).

by AndroidBlogger ([email protected]) at January 21, 2010 11:38 PM

Coming out of Winter hibernation

Happy New Year and I hope everyone is having a great 2010 so far!

If you know me through any medium such as my blog, Twitter, Facebook, email or through events like the Edinburgh TechMeetup you probably haven't seen me update or communicate for a while.

Well over winter I pretty much went into hibernation mode. I've been playing a lot of Eve-Online and not doing any freelance work - pretty much ignoring anyone and everyone who has been in contact. But I had my reasons.

2009 was a bit of a crappy year to be honest.

In the whole year I never had a proper holiday, I was overworked and underpaid and this meant no chance to just unwind and de-stress.

So at the end of the 2009 I decided to take the time to just do this.

Between things like my girlfriend being diagnosed with penetrative Crohn's (they said it was cancer at first) which meant her going through major surgery - to my laptop breaking and not being able to afford to replace it (and I still haven't as of yet) - it just felt like everything that could go wrong, did.

But now we're just over half way through January and I've decided it's time to finally come out of the cave of despair, get back into working and look forward to 2010.

So as of now I'm contactable again. I'm actively looking for some extra freelance stuff - especially PHP or Android development - so I can afford to get myself a new PC and look at saving up for a holiday this year.

DZone Google Reader Tumblr Delicious LiveJournal Twitter Technorati Favorites Reddit FriendFeed Facebook Share/Bookmark

by Tane Piper at January 21, 2010 12:30 PM

Ask Not What Google Can Do For Developers...

Many people have lots of ideas of things that Google should do with Android. These range from code changes to Market changes to license changes to support changes. Heck, I've had and written about a few of them myself. However, by and large, I have concluded that making such suggestions is ineffective. Read more

by Mark Murphy at January 21, 2010 07:30 AM

January 20, 2010

Android: Eclipse and problems with dynamic tables (adding rows)

When using TableLayout with LayoutParams Eclipse will automatically (and wrongly) add the following import: import android.view.ViewGroup.LayoutParams; However if you try to use this you will notice that nothing changes. You need to replace the import with the ollowingL import android.widget.TableRow.LayoutParams; Now if you rerun your code, you will see that your tables are updating. See below for an example [...]

by mat at January 20, 2010 10:00 PM

SlideScreen released!

A couple rewrites and 17 beta versions later, our home screen replacement SlideScreen is finally live in the Android Market! If you haven’t read about the app before check out the product page to see what it’s about, or read our original blog post about the ideas behind the design. The reviews have started coming [...]

by Matt Hall at January 20, 2010 06:45 PM

IRC office hours update


You may recall that we announced IRC Office Hours for Android app developers back in December. We just want to provide a quick update that upcoming office hours will be held on Thursdays from 5 p.m. to 6 p.m. PST, instead of twice weekly. These will be held in the #android-dev channel on irc.freenode.net as before.

Please post your questions on Stack Overflow with "from-irc" tag in addition to "android" tag one day before office hours. We will follow up on those specific questions during office hours, and will also post answers after.

We hope to see you there!

by Megha Joshi ([email protected]) at January 20, 2010 05:12 PM

Key Dates and projects beginning 2010

2010 promises to be an interesting year for Android. Starting off on the right foot I’d like to share some key dates and projects of general interest with everyone.
If there are any other events on the horizon we’d love to know about them so please get in touch and share.

Community Calendar

The closest thing a a community calendar in the Android world is the one started by a bunch of blogger sites including androidguys and anddroidandme
To subscribe to the community maintained Android global events calendar see here:
http://www.google.com/calendar/embed?src=g72pef2iiuu28hmedcnce5h0u4%40group.calendar.google.com&ctz=Europe%2FLondon&gsessionid=ycdhn2eV3gvznWmB8IIIlQ

Upcoming Android Related Events

Mobile World Congress (MWC), Barcelona
15 - 18th Feb
€599 - €4,999
http://www.mobileworldcongress.com
The world’s largest mobile event

Google IO, San francisco
May 19th & 20th
$400/$500/ student $100
http://code.google.com/events/io/2010/
Google’s annual global get together.


Londroid - The London Android meetup
Monthly, free
http://www.meetup.com/android
http://www.londroid.co.uk
Skillsmatter London
- Jan21, Feb18, Mar18, Apr22, May20, Jun17
Our fave monthy meeting. Very much recommended.

GeoMob
Monthly meetings, London 21Jan
http://gmdlondon.ning.com/

Droidcon Berlin, Nov? TBD £100
Droidcon London, Dec? TBD £100
Last year’s explicitly Android themed conference events. Dates will likely be announced within a few months.
http://www.droidcon.de/

Android Meetup Barcelona
16Feb (while MWC)
http://eventuo.com/of/barcelona-androides
A month;y get together in Barcelona. We’ll be attending the one held during MWC.

Android Stammtisch Berlin, C-base
http://www.android-in-berlin.de/
Jan 27, Feb 24
The monthly meetup held in Berlin’s excellent C-base hackspace.

JavaUserGroup
Monthly
http://jroller.com/javawug/

Chigago Android eco-challenge hacakthon
Feb 6th, $1
http://chigtug6.eventbrite.com/

Mobile Monday London
Monthly meetings
http://momolo.org/

FosDem, Brussels Belgium
6-7th Feb
http://fosdem.org/2010/

AppJam
http://www.meetup.com/App-Jam/

Mobile Geeks of London
Monthly meetup
facebook group

CTIA Wireless, Las vegas
March 23-25
http://www.ctiawireless.com/

WhereCampEU
March 12,13th
London
http://wherecamp.eu/

Podcasts

Androidguys - http://www.blogtalkradio.com/androidguys
Motodev - http://www.blogtalkradio.com/motodev
The Java Posse - http://javaposse.com/

Community hotspots

IRC - irc.freenode.net  - #android, #android-dev
The most active community channel for developers just generally getting together and chatting has been the IRC chat room from Android’s conception. A regular haunt for the members of Google’s Android team this chatroom is a the closest thing to a point of contact with the Android team.

Sites

Android neighbourhood - http://okmijnt.appspot.com/ - The AndroidNeighbourhood was started as an extension to the official android site listing all of the upcoming worldwide Android events.
Android and Me - Popular Android enthusiast website with good periodicals and reporting
planetandroid.com - The big daddy Android aggregator. If you watch one site for Android news, watch this one.
anddev.org - This forum has remained one of the most active communities in enthusiast Android development since the early betas
android-devices.net - nice source for upcoming Android devices.
androidbloke.co.uk - UK based news source
androidguys.com - A popular community for android developers and enthusiasts alike
Open intents Group - The chat group for Open intents

Projects

The most important open source projects are undoubtedly:
Open intents -  Open intents is a project to publically declare agreed standards for intents outside Google. The source repo for open intent projects is here: http://code.google.com/p/openintents/
and the open intents registry - http://www.openintents.org/en/intentstable ,
Open Android Alliance - http://code.google.com/p/open-android-alliance/

Although there has been very little movement from the open android alliance, open intents are very active.
Some notable other libraries that which we believe are useful:

Android - source.android.com
Commonsware - Lot of very interesting and useful Android projects including code for caching, tutorials and helpful Adapters.
Droid-fu - A utility library for your daily Android needs
Calculon - Story based functional tests
Angle - an open GL game engine
Live Android - An Android Live OS CD for x86
Android x86 project - x86 ports
Android on Github - Mirror of Android repo
Phone Gap - Take advantage of platform specific features through a generic Javascript API

Signpost - A light-weight client-side OAuth library for Java
RESTProvider - Automatically parses RESTful API responses into a Provider in Android
Maven-android-plugin maven build plugin for android, useful for continuous integration.
OAuth dashboard / providers - An OAuth Library/application for Android. Acts as a dashboard for users permissions that they have allowed/dissalowed to applications and for developers gives them an easy way to securely authenticate using a thirdparty android OAuth implementation.

Busybox - See here for how to install on Android. Adds chown, chgrp, awk, sed, grep, du, vi, pidof, less, tail, gunzip, gzip, tar, bzip2, clear, crontab, crond, diff, httpd, telnet, xargs, su, wget, which
DoomForAndroid - http://code.google.com/p/doom-for-android/ - Doom
androidscreencast - http://code.google.com/p/androidscreencast/ - Control an android device remotely

Twitter

Most popular twits: http://wefollow.com/twitter/android
A list of Android related people I think are worth following on twitter here: http://twitter.com/kevinmcdonagh/droids/members

by admin at January 20, 2010 02:46 PM

XMarks Android Code

Android Application Development: Programming with the Google SDK I’ve had repeated requests for the code for the xmarks Android application I was writing. I’ve not touched it in months now so I can’t remember exactly what state the code is in, but you can get a tarball of it from here. If you compile and use it, you do so entirely at your own risk and I’m not responsible if it blows your phone up.

I don’t really have any intention to complete the application unless the Android bookmarks app gets support for multi-level folders. At the moment, there is no folder support at all. [...]

by Mike Cardwell at January 20, 2010 01:45 PM

XMarks (Foxmarks) bookmark sync

Android Application Development: Programming with the Google SDK I’ve been developing an application for Android which synchronises your bookmarks with XMarks (Foxmarks). I passed a milestone today. At the moment you can start up the application and add your xmarks username and password to the settings. Then you go to the main page where it has three buttons “Download”, “Upload” and “Sync”. [...]

by Mike Cardwell at January 20, 2010 01:45 PM

Google Phone Battery Usage Graphing

Android Application Development: Programming with the Google SDK I’ve been learning how to program for my Android G1 “google phone” recently. I wanted to learn how to use the database and network communication APIs at the same time as learning how to write background services. I decided I would write something to monitor my battery level and upload data about it to my server which would then graph it using RRDtool. The final result is the following three graphs. They’re not static graphs, they’re being updated every fifteen minutes: [...]

by Mike Cardwell at January 20, 2010 01:45 PM

JARs on the classpath

Directory tree of a typical Android project (at least those created by the "android create project" command) looks like this:



As you may have seen the directory structure of countless J2SE projects, there is a directory to store the 3rd party class libraries of the project. Under the "lib" directory, you can place your Java class libraries in JAR format and they will be added to the classpath when the Android application is running.

Or will they? If you remember the APK format, there is no such thing as directory for libs in JAR format, particularly because the Dalvik VM is simply not able to execute ordinary Java class files in those JARs. You can find JARs on the device but these JARs contain class files in DEX format (Dalvik VM's class file format) inside so the extension of these files is misleading. Then where are those JARs from the lib directory that we "added to the classpath"?

You might have guessed it: these JARs are unpacked, processed by the dx tool just like the classes under the src directory and are placed into the same classes.dex file where the application resides. One application is one DEX file and JARs containing Java class files are not "added to the classpath", they are converted into DEX format and added to the DEX file of the application. Unlike in OSGi, an Android installable package cannot share code with other system components, only services.

by Gabor Paller ([email protected]) at January 20, 2010 01:20 PM

January 19, 2010

SpamAssassin 2010 Bug

SpamAssassin (Paperback) I use SpamAssassin to filter the spam out of my incoming email. Last night I noticed that a legitimate email had a particularly high spam score. On further investigation I found that a rule named FH_DATE_PAST_20XX was triggering:

* 3.2 FH_DATE_PAST_20XX The date is grossly in the future

I checked the Date header of the email and it looked totally fine to me. It had just changed from the year 2009 to the year 2010. Could that be a coincidence? A quick look in /usr/share/spamassassin/72_active.cf turned up the rule:

header FH_DATE_PAST_20XX Date =~ /20[1-9][0-9]/ [if-unset: 2006]

Oops. That regex matches on any year between 2010 and 2099. I googled for the rule and came across this: [...]

by Mike Cardwell at January 19, 2010 11:15 PM

Nexus One Skin

A friend of mine asked for this one. Feel free to download it:

by Tughi at January 19, 2010 06:21 PM

What the Doodle!?

What the Doodle!? is a real-time online multiplayer draw-guess game that features a variety of game modes, Private Games, High Scores, Personal face doodles, integrated Voice Recognition + more!

Price: Free, UK£1.00

AndroidTapp.com Android Game Review:

Pros & Cons:

Pros

  • Creative Addictive Fun
  • Real-time multi-player online charades type game

Cons

  • The interface and drawing controls could use more organization
  • Various connection speeds of players causes lag in time for drawing to appear

Features:

What the Doodle!? Android Game is an overall winner of Google’s second Android Developer Challenge for a reason… creative addictive fun! What the Doodle is an online multi-player Charades type game somewhat similar to Pictionary where you are given a word to draw/doodle and see if others can guess your word; in turn you try to guess what the other person is drawing and you’re awarded points if you succeed or deducted if players don’t guess your word. What’s cool about What the Doodle is the uncertainty of the players involved; you may have someone who doodles well or not.

You can “Accuse” people who you think are cheating. I funny anecdote while playing this game. My word to draw was “ponytail”, so I drew a girls head with emphasis on the ponytail then drew an arrow pointing to it. Someone guessed it right, then I got a notice that I had been accused of cheating, so I wondered who and shortly found. It was the player who soon started cheating themselves by writing the keyword versus drawing it; ironically the game detected this and popped up an alert asking each player if you suspect another player of cheating, once majority of confirms it boots the player.

Gripe Alerts: One thing that is an unfortunate bummer is that lag (average of 5-10 seconds) before you start seeing anything your competitors are drawing. Not that it is necessarily the app itself but dealing with various Internet connection speeds of players factor largely. An “Erase” feature would be nice, the only option you have is to “Clear” the whole drawing and redraw. The drawing controls are simple, just not quickly intuitive to toggle when trying to draw your keyword fast.

Video: What the Doodle!?

http://www.youtube.com/watch?v=YKhvqR7_4yk

What The Doodle!? Start Screen What The Doodle!? Game Options What The Doodle!? Choose Game Levels What The Doodle!? (Bad Use of Virtual Keyboard During Game) What The Doodle!? Player Console What The Doodle!? Correct Word Guess What The Doodle!? Drawing My Doodle What The Doodle!? Game Over Winner! What The Doodle!? Profile What The Doodle!? Top Players

Fun Factor & Addictive:

Crack open the game, join a session and you’ll soon figure out just how fun and addictive the game gets.

Interface:

The user interface can seem quite cumbersome once the game lures you in. If you’re using a Android phone without the physical keyboard like a Nexus One, you’ll find that typing your answer on-screen hinders you a bit as it takes over the entire screen as you’re typing. You have to switch back to see what’s going on.

AndroidTapp.com Rating

AndroidTapp.com Rating!AndroidTapp.com Rating!AndroidTapp.com Rating!AndroidTapp.com Rating!AndroidTapp.com Rating! (4.1 out of 5)

Should you Download What the Doodle!? Yes! Play Online or Invite Friends with Android Phones!

by Antonio Wells at January 19, 2010 04:18 PM

Attaching Android platform source in Eclipse

Are you tired of seeing this when you look at your platform JAR in Eclipse?

Dude, where's my source?

Or how about this when you’re debugging?

How am I supposed to debug this?

Android is open source, right? So how do we see the source?

Some background

  • Tip: If you’re just here to get it working and don’t care where it came from, you can skip on a bit.

This article summarizes and augments three other posts that spelled out how to get the source and use it. It is surprisingly difficult to get your hands on the correct version of the source you need for this purpose, so in addition to describing that process I’m providing the end result for your convenience.

My sources

My three source posts are:

Both the posts and the comments were very helpful, but somewhat out of date now. How to put it all together?

Getting the right code

The source is all available, but it’s spread out among several projects which put together constitute the Android Open Source Project. Thus I needed to install the repo tool (as described on the “Get source” page) in order to pull down all of the relevant git repositories. The articles describe getting the latest code – the trick is getting the code specific to the platform version you’re working on; at the time everyone was working with 1.0!

When you sync the Android repos, you’ll see output describing the available branches and tags something like this:

 * [new branch]      cupcake    -> korg/cupcake
 * [new branch]      cupcake-release -> korg/cupcake-release
 * [new branch]      donut      -> korg/donut
 * [new branch]      donut-release -> korg/donut-release
 * [new branch]      eclair     -> korg/eclair
 * [new branch]      master     -> korg/master
 * [new branch]      release-1.0 -> korg/release-1.0
 * [new tag]         android-1.0 -> android-1.0
 * [new tag]         android-1.5 -> android-1.5
 * [new tag]         android-1.5r2 -> android-1.5r2
 * [new tag]         android-1.5r3 -> android-1.5r3
 * [new tag]         android-1.5r4 -> android-1.5r4
 * [new tag]         android-1.6_r1 -> android-1.6_r1
 * [new tag]         android-1.6_r1.1 -> android-1.6_r1.1
 * [new tag]         android-1.6_r1.2 -> android-1.6_r1.2

This list generally contains some other random stuff and varies by project. The tags seem to be logically named and standardized across projects, but I couldn’t find how to get the repo tool to pull source based on a tag (if someone knows, by all means comment below). Repo takes the -b option to specify a branch however, and the cupcake / donut / eclair branches are universal, so those are what I used to make the source archives linked in this article, e.g.:

repo init -u git://android.git.kernel.org/platform/manifest.git -b cupcake
repo sync

Of course, branches are generally moving targets, so caveat emptor.

Assembling the code as Eclipse expects it

If you follow the above and have a good connection and some patience, you’ll eventually have a directory full of some 2GiB of “stuff,” some of which is the source code you’re looking for. But Eclipse needs just the source, in just the right place. Forster’s post “View Android Source Code in Eclipse” provides a python script for rounding up the source code and creating a nice zip archive out of it, and Burke’s post “Browsing Android Source in Eclipse” describes how to figure out where to put it – in a “sources” directory created underneath the SDK platform directory. Other comments on those posts are helpful for coercing Eclipse to recognize that the source is available.

What you came here for

Without further ado, here’s how you attach source to your platform classes. N.B. all screenshots are from Eclipse 3.5 “Galileo” – other versions may differ significantly.

Download source

Download the zipped source code that I’ve gathered for each platform you are developing for.

Put the source in place

For each platform, create a folder “sources” under that platform (e.g. sdk/platforms/android-1.5/sources) and unzip the source code into it. Then refresh your project (select project and press F5 or right-click and select “Refresh”).

Right click on the project and refresh

Voila, you should see the source!

YES, I SEE the SOURCE!

Getting the debugger on board

I found that even after I’d placed sources in the platform, if I was debugging and ended up deep in the platform (In this case, with an exception), the debugger might not show the code:

Sometimes the debugger still won't show the source

However, it’s fairly straightforward to fix this. Just click on that “Edit Source Lookup Path” button to add a source lookup path. In that dialog leave “Default” selected and click “Add.”

In the following “Add Source” dialog choose “File System Directory” and hit the OK button:

Then choose the source directory where you unzipped the code. The debugger should now show all the code you can debug into.

Source in the debugger... which may or may not help you figure out what went wrong; in this case, a layout error caught at runtime.

A word of caution, though: Eclipse’s debugger seems to think that once you’ve set a source lookup for one project, it’s relevant for all of them. If you’re using different platforms for different projects, you’ll want to change the source it uses. You can do that by right-clicking on the project in the debugger and choosing “Edit Source Lookup” to repeat this process.

Getting back to source lookup in the debugger

Patches welcome

Hopefully this guide makes attaching source easy for you. If the code provided here seems out of sync with the platform when you’re debugging, let me know. If someone knows a better way to pick out the exact code for the different platform versions, comment below. If I’ve slightly (or utterly) misrepresented something, correct me. If you’re just happy to finally see your source, I’d be glad to hear about it!

http://source.android.com/download/

by luke at January 19, 2010 02:15 PM

ContentProvider User Demo

Content Providers are the Android platforms way of sharing information betweeen multiple applications through its ContentResolver interface. Each application has access to the SQLite database to maintain their information and this cannot be shared with another application.

In this demo, we use the content provider information avaialable through the getContentResolver() method to get device information with the contentresolver instance and quierying the provided cursor. Apart from query, you can with the related methods, the ability to insert, update, delete and getType (to extract the MIME type).

End result is the list of all the system setting on the user on the android device.

With the SimpleCursorAdapter instance makes use of the row.xml with cursor information to populate the listView withing the main.xml layout.

ContentUserDemo.java
Code:

package org.example.cp;


import android.app.Activity;
import android.content.ContentResolver;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.Settings;
import android.util.Log;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;


public class ContentUserDemo extends Activity {
private static final String TAG = "ContentUserDemo";

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

// Get content provider and cursor
ContentResolver cr = getContentResolver();
Cursor cursor = cr.query(Settings.System.CONTENT_URI, null, null, null, null);

// Let activity manage the cursor
startManagingCursor(cursor);
Log.d(TAG, "cursor.getCount()=" + cursor.getCount());

// Get the list view
ListView listView = (ListView) findViewById(R.id.listView);
String[] from = { Settings.System.NAME, Settings.System.VALUE };
int[] to = { R.id.textName, R.id.textValue };
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.row, cursor, from, to);
listView.setAdapter(adapter);
}
}


Addition to the AndroidManifest.xml

Do not forget to add the following user permission tag <uses-permission android:name="android.permission.READ_CONTACTS" /> To givee your application access to the contacts information.

AndroidManifest.xml

Code:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.example.cp" android:versionCode="1" android:versionName="1.0.0">
<uses-permission android:name="android.permission.READ_CONTACTS" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".ContentUserDemo" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>



row.xml

Where the individual row information is populated.
Code:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:padding="5sp"
android:layout_width="fill_parent">
<TextView
android:layout_height="wrap_content"
android:id="@+id/textName"
android:text="Name"
android:textSize="18sp"
android:layout_width="fill_parent"
android:layout_weight="1"></TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textValue"
android:text="Value"
android:textSize="18sp"
android:gravity="right"></TextView>
</LinearLayout>


main.xml

Where all the rows.xml populate the ListView tag
Code:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/listView">
</ListView>
</LinearLayout>




ScreenShot


Source
http://marakana.com/static/tutorials/ContentUserDemo.zip

by Serete Itebete at January 19, 2010 01:00 PM

Android Gestures

Like it or not touch screens are becoming part of both developers and users life, i mean dont think i would buy one of Those uncool phones without touchscreen unless i really have to, would you? but the important point is that what is the Touchscreen use if applications doesn't support touchscreen interaction, in other words who is really gonna pay for a ,say, Picture management application if it does not support some gestures for switching between pictures or zooming? [ Gesture Detection in Android ].
In Android there are three levels of touch screen event handling mechanism which can be used by developers. the most low level technique is to receive all touch events and take care of all things, you can attach an 'OnTouchListener' to a view and get notified whenever there is a touch event or you can override onTouchEvent() or dispatchTouchEvent() method of your activity or view, in all these cases you would be dealing with an instance of MotionEvent every single time and you would have to detect what user is doing all on your own which will suit requirments for developing games and stuff like that. But it is just too much hassle if you only need a few simple gestures for your application.
Next approach is to use GestureDetector class along with OnGestureListener and/or OnDoubleTapListener, in this technique whenever there is a new MotionEvent you have to pass it to Gesture Detector's onTouchEvent() method, it then will analyse this event and previous events and tell you what is happening on the screen by calling some of the callback methods.
here is a simple activity which uses GestureDetector :




public class SimpleActivity extends Activity implements OnGestureListener,
OnDoubleTapListener{

private GestureDetector detector;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

detector = new GestureDetector(this,this);
}

@Override
public boolean onTouchEvent(MotionEvent me){
this.detector.onTouchEvent(me);
return super.onTouchEvent(me);
}

@Override
public boolean onDown(MotionEvent e) {
Log.d("<<<>>>",e.toString());
return false;
}

@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) {
Log.d("<<<>>>",e1.toString()+e2.toString());
return false;
}

@Override
public void onLongPress(MotionEvent e) {
Log.d("<<<>>>",e.toString());
}

@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
float distanceY) {
Log.d("<<<>>>",e1.toString()+e2.toString());
return false;
}

@Override
public void onShowPress(MotionEvent e) {
Log.d("<<<>>>",e.toString());
}

@Override
public boolean onSingleTapUp(MotionEvent e) {
Log.d("<<<>>>",e.toString());
return false;
}

@Override
public boolean onDoubleTap(MotionEvent e) {
Log.d("<<<>>>",e.toString());
return false;
}

@Override
public boolean onDoubleTapEvent(MotionEvent e) {
Log.d("<<<>>>",e.toString());
return false;
}

@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
Log.d("<<<>>>",e.toString());
return false;
}

}


if we want to understand all gesture types and how they work, first of all we need to know three basic MotionEvents which can combine with each other and create some gestures, these three Events are Action_Down , Action_Move and Action_Up , each time you touch the screen an Action_Down occurs and when you start moving it will create Action_Move event and finally when you take your finger off the screen an Action_Up Event will be created.
onDown() is called simply when there is an Action_Down event.
onShowPress() is called after onDown() and before any other callback method, I found out it sometimes might not get called for example when you tap on the screen so fast, but it's actually what this method all about, to make a distinction between a possible unintentional touch and an intentional one.
onSingleTapUp() is called when there is a Tap Gesture. Tap Gesture happens when an Action_Down event followed by an Action_Up event(like a Single-Click).
onDoubleTap() is called when there is two consecutive Tap gesture(like a Double-Click).
onSingleTapConfirmed() is so similar to onSingleTapUp() but it is only get called when the detected tap gesture is definitely a single Tap and not part of a double tap gesture.
Here is the sequence in which these callback methods are called when we tap on the screen:

onDown() – onShowPress() - onSingleTapUp() – onSingleTapConfirmed()


and here is when we do a double tap:


onDown() – onShowPress() - onSingleTapUp() – onDoubleTap() – onDoubleTapEvent()
onDown() – onShowPress() – onDoubleTapEvent()


onFling() is called when a Fling Gesture is detected. fling Gesture occurs when there is an Action_Down then some Action_Move events and finally an Action_Up, but they must take place with a specified movement and velocity pattern to be considered as a fling gesture. for example if you put your finger on the screen and start moving it slowly and then remove your finger gently it won’t be count as a fling gesture.

onScroll() is usually called when there is a Action_Move event so if you put your finger on the screen and move it for a few seconds there will be a method call chain like this :


onDown() – onShowPress() – onScroll() - onScroll() - onScroll() - ....... - onScroll()


or If the movement was a Fling Gesture, then there would be a call chain like this :


onDown() – onShowPress() – onScroll() - onScroll() - onScroll() - ....... – onFling()

If there is an Action_Move event between first tap and second tap of a doubleTap gesture it will be handled by calling onDoubleTapEvent() instead of onScroll() method. onDoubleTapEvent() receives all Action_Up events of a doubleTap gesture as well.
Remember that if we touch the screen and don’t remove our finger for a specified amount of time onLongPress() method is called and in most cases there will be no further event callback regardless of whatever we do after that, moving or removing our finger. we can easily change this behavior of detector by calling setIsLongpressEnabled() method of GestureDetector class.
although GestureDetector makes our life much easier, it still could be a real pain in the ass if we would need to handle some complicated gestures, imagine you need an application which should do task1 when there is a circle gesture, task2 for rectangle gesture and task3 for triangle gesture. obviously it would not be so pleasant to deal with such a situation with those mechanism we have seen so far, it's actually when Gesture API and Gesture Builder Application come into play.
Gesture Builder Application comes with Android emulator as a pre-installed app, It helps us to simply make new gestures and save them on the device, then we can retrieve and detect those gestures later using Gesture API. I'm not gonna talk about Gesture Builder app here,since there is a pretty good Article about it on Android Developers blog.
the only thing I'd like to mention here is GestureOverlayView class, It is actually just a transparent FrameLayout which can detect gestures but the thing is it can be used in two completely different ways, you can either put other views inside it and use it as a parent view or put it is the last child view of a FrameLayout (or any other way which causes it to be placed on top of another view).
In the first Scenario all child views will receive Touch events, therefore we will be able to press buttons or interact with other widgets as well as doing some gestures, on the other hand if GestureOverlayView has been placed on top, it will swallow all Touch events and no underlay view will be notified for any touch Event.
Although Gesture API brings many useful features for us, I personally prefer to use GestureDetector for some simple, basic gestures and honestly I feel like something is missing here, I mean , apart from games, I would say more than 70% of all gestures that might be needed in our applications are just a simple sliding in different directions or a double tap. and that's why I have decided to come up with something easy which can enable us to handle those 70% as simple as possible. how simple? you might be asking...
here is how our previous activity will look like if we use SimpleGestureFilter class :




public class SimpleActivity extends Activity implements SimpleGestureListener{

private SimpleGestureFilter detector;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

detector = new SimpleGestureFilter(this,this);
}

@Override
public boolean dispatchTouchEvent(MotionEvent me){
this.detector.onTouchEvent(me);
return super.onTouchEvent(me);
}

@Override
public void onSwipe(int direction) {
String str = "";

switch (direction) {

case SimpleGestureFilter.SWIPE_RIGHT : str = "Swipe Right";
break;
case SimpleGestureFilter.SWIPE_LEFT : str = "Swipe Left";
break;
case SimpleGestureFilter.SWIPE_DOWN : str = "Swipe Down";
break;
case SimpleGestureFilter.SWIPE_UP : str = "Swipe Up";
break;

}
Toast.makeText(this, str, Toast.LENGTH_SHORT).show();
}

@Override
public void onDoubleTap() {
Toast.makeText(this, "Double Tap", Toast.LENGTH_SHORT).show();
}

}


and here is SimpleGestureFilter source code :




public class SimpleGestureFilter extends SimpleOnGestureListener{

public final static int SWIPE_UP = 1;
public final static int SWIPE_DOWN = 2;
public final static int SWIPE_LEFT = 3;
public final static int SWIPE_RIGHT = 4;

public final static int MODE_TRANSPARENT = 0;
public final static int MODE_SOLID = 1;
public final static int MODE_DYNAMIC = 2;

private final static int ACTION_FAKE = -13; //just an unlikely number
private int swipe_Min_Distance = 100;
private int swipe_Max_Distance = 350;
private int swipe_Min_Velocity = 100;

private int mode = MODE_DYNAMIC;
private boolean running = true;
private boolean tapIndicator = false;

private Activity context;
private GestureDetector detector;
private SimpleGestureListener listener;


public SimpleGestureFilter(Activity context,SimpleGestureListener sgl) {

this.context = context;
this.detector = new GestureDetector(context, this);
this.listener = sgl;
}

public void onTouchEvent(MotionEvent event){

if(!this.running)
return;

boolean result = this.detector.onTouchEvent(event);

if(this.mode == MODE_SOLID)
event.setAction(MotionEvent.ACTION_CANCEL);
else if (this.mode == MODE_DYNAMIC) {

if(event.getAction() == ACTION_FAKE)
event.setAction(MotionEvent.ACTION_UP);
else if (result)
event.setAction(MotionEvent.ACTION_CANCEL);
else if(this.tapIndicator){
event.setAction(MotionEvent.ACTION_DOWN);
this.tapIndicator = false;
}

}
//else just do nothing, it's Transparent
}

public void setMode(int m){
this.mode = m;
}

public int getMode(){
return this.mode;
}

public void setEnabled(boolean status){
this.running = status;
}

public void setSwipeMaxDistance(int distance){
this.swipe_Max_Distance = distance;
}

public void setSwipeMinDistance(int distance){
this.swipe_Min_Distance = distance;
}

public void setSwipeMinVelocity(int distance){
this.swipe_Min_Velocity = distance;
}

public int getSwipeMaxDistance(){
return this.swipe_Max_Distance;
}

public int getSwipeMinDistance(){
return this.swipe_Min_Distance;
}

public int getSwipeMinVelocity(){
return this.swipe_Min_Velocity;
}


@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) {

final float xDistance = Math.abs(e1.getX() - e2.getX());
final float yDistance = Math.abs(e1.getY() - e2.getY());

if(xDistance > this.swipe_Max_Distance || yDistance > this.swipe_Max_Distance)
return false;

velocityX = Math.abs(velocityX);
velocityY = Math.abs(velocityY);
boolean result = false;

if(velocityX > this.swipe_Min_Velocity && xDistance > this.swipe_Min_Distance){
if(e1.getX() > e2.getX()) // right to left
this.listener.onSwipe(SWIPE_LEFT);
else
this.listener.onSwipe(SWIPE_RIGHT);

result = true;
}
else if(velocityY > this.swipe_Min_Velocity && yDistance > this.swipe_Min_Distance){
if(e1.getY() > e2.getY()) // bottom to up
this.listener.onSwipe(SWIPE_UP);
else
this.listener.onSwipe(SWIPE_DOWN);

result = true;
}

return result;
}

@Override
public boolean onSingleTapUp(MotionEvent e) {
this.tapIndicator = true;
return false;
}

@Override
public boolean onDoubleTap(MotionEvent arg0) {
this.listener.onDoubleTap();;
return true;
}

@Override
public boolean onDoubleTapEvent(MotionEvent arg0) {
return true;
}

@Override
public boolean onSingleTapConfirmed(MotionEvent arg0) {

if(this.mode == MODE_DYNAMIC){ // we owe an ACTION_UP, so we fake an
arg0.setAction(ACTION_FAKE); //action which will be converted to an ACTION_UP later.
this.context.dispatchTouchEvent(arg0);
}

return false;
}


static interface SimpleGestureListener{
void onSwipe(int direction);
void onDoubleTap();
}

}


as you can see clients of these class can determine the minimum and maximum distance and also minimum velocity which is required for a movement on screen to be considered as a Swipe Gesture, I also thought it would be great if our filter can behave differently like what GestureOverlayView can do and even more than that!
this Filter can run in three different mode: Transparent, Solid and Dynamic. in Transparent mode it will work just like when we have a GestureOverlayView as parent: all views will receive Touch events; Solid mode works like when we put a GestureOverlayView as a child view: no one will receive TouchEvent, it is not as efficient as GestureOverlayView is, since we actually let all events get passed but what we do is we literally kill them when they are passing through our filter ;).
the last mode is Dynamic mode, the primary purpose of this mode is to have a bit smarter gesture detection, i mean there has been sometimes that i wanted to slide from one page to another, but a button get pressed and something else happens. it does not happen so much but it is really annoying. what i tried to do in Dynamic mode is to distinguish between a swipe/double tap gesture and a movement which is neither of them. so if you have a view full of buttons and other interactive stuff and user does a swipe or double tap gesture, it is guaranteed (although i believe there is no such thing as guarantee in life ;) ) that no other event callback will be called but only onSwipe() or onDoubleTap().
Anyway that's what i came up with to take the pain away in those circumstances when we just need to handle some simple Gestures.
hope it will be helpful for you and can make your life a bit easier.

by Amir ([email protected]) at January 19, 2010 09:55 AM

January 18, 2010

Android Continuos Integration: Build with maven


Android Continuous Integration: Build with maven


















This document can be read in Google Docs (http://docs.google.com/View?id=ddwc44gs_226ds4kfpff), cut and paste link if you have problems accessing it.

If you have problems seeing the images, like the icon in this box don't blame me, it seems to be an issue when you publish to Blogspot from Google Docs.



















introduction




"Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily - leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible."











We have written some tests for our project and now we would like to take continuous integration into account, mainly if we are working in an enterprise development environment and our team has several developers.



We all are very much accustom to use Eclipse and Android ADT as our main developer environment, so it's logical that even though we are increasing our team size we don't want to left behind that experience and start using a different tool from scratch. At the same time, it's pretty clear that using maven as a build tool for the project we obtain a great level of simplification, mainly if we use hudson, cruise control or similar continuous integration tools.



That's why the approach presented here is to let both models co-exist.











project structure




We are also considering here that a VCS is used and a parent project containing both the main and test project is under this VCS control.



The structure of our project P1 will be

















the P1 project including AP1 application's main project and its tests in AP1Test.

To create these projects you should follow this sequence:






  1. Create a Project (File -> New... -> Project), P1 in this case

  2. Add a pom.xml file (File -> New... -> Other -> Maven -> Maven POM file). We will review its content later

  3. Create an Android Project (New... -> Android Project), AP1, using P1 folder instead of the default location, but DON'T create the test project yet or it will fail (ADT 0.9.5)

  4. Add a pom.xml file to AP1 (File -> New... -> Other -> Maven -> Maven POM file). We will review its content later

  5. Selecting AP1 project, create the corresponding test project AP1Test (Android Tools -> New Test Project) using again P1 as the location

  6. Add a pom.xml file to AP1 (File -> New... -> Other -> Maven -> Maven POM file). We will review its content later

  7. You can now import the whole project structure to your VCS






pom files


You need to define some things inside your pom files in order to get the Android projects correctly built.

P1's pom.xml


We are using maven-android-plugin here, visit its site for further details.













 1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">


 2   <modelVersion>4.0.0</modelVersion>


 3   <groupId>P1</groupId>


 4   <artifactId>P1</artifactId>


 5   <packaging>pom</packaging>


 6   <version>0.0.1-SNAPSHOT</version>


 7   


 8    <build>


 9         <sourceDirectory>src</sourceDirectory>


10         <plugins>


11             <plugin>


12                 <groupId>org.apache.maven.plugins</groupId>


13                 <artifactId>maven-compiler-plugin</artifactId>


14                 <version>2.1</version>


15                 <configuration>


16                     <source>1.6</source>


17                     <target>1.6</target>


18                 </configuration>


19             </plugin>


20             <!--


21                maven-android-plugin doesn't delete files from bin,


22                only from target, we are deleting them here


23             -->


24             <plugin>


25                <groupId>org.apache.maven.plugins</groupId>


26                <artifactId>maven-clean-plugin</artifactId>


27                <version>2.2</version>


28                <configuration>


29                   <filesets>


30                      <fileset>


31                         <directory>bin</directory>


32                         <includes>


33                            <include>**/*</include>


34                         </includes>


35                      </fileset>


36                      <fileset>


37                         <directory>gen</directory>


38                         <includes>


39                            <include>**/*</include>


40                         </includes>


41                      </fileset>


42                   </filesets>


43                </configuration>


44             </plugin>


45             <plugin>


46                 <groupId>com.jayway.maven.plugins.android.generation2</groupId>


47                 <artifactId>maven-android-plugin</artifactId>


48                 <configuration>


49                     <sdk>


50                         <!--  

                            <path>${env.ANDROID_HOME}</path>

                           --
>


51                         <path>/opt/android-sdk/</path>


52                         <platform>2.1</platform>


53                     </sdk>


54                     <deleteConflictingFiles>true</deleteConflictingFiles>


55                 </configuration>


56                 <extensions>true</extensions>


57             </plugin>


58         </plugins>


59     </build>


60    <modules>


61       <module>AP1</module>


62       <module>AP1Test</module>


63    </modules>


64    <dependencies>


65       <dependency>


66          <groupId>android</groupId>


67          <artifactId>android</artifactId>


68          <version>2.1</version>


69          <type>jar</type>


70          <scope>provided</scope>


71       </dependency>


72    </dependencies>


73


74     <dependencyManagement>


75         <dependencies>


76             <dependency>


77                 <groupId>android</groupId>


78                 <artifactId>android</artifactId>


79                 <version>2.1</version>


80                 <scope>provided</scope>


81             </dependency>


82         </dependencies>


83     </dependencyManagement>


84 </project>





Basically we
  1. define our source directory as src to be compatible with the Eclipse Android project structure
  2. configure the maven-compiler-plugin according to our needs
  3. clean Eclipse Android project structure too in our clean goal
  4. configure maven-android-plugin defining the location of the Android SDK. This can be defined here or read from the environment
  5. define our modules, in this case the main project AP1 and its tests AP1Test
  6. define the dependencies, android 2.1 in this case

AP1's pom.xml











 1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">


 2   <modelVersion>4.0.0</modelVersion>


 3   <groupId>AP1</groupId>


 4   <artifactId>AP1</artifactId>


 5   <packaging>apk</packaging>


 6   <version>0.0.1-SNAPSHOT</version>


 7   <parent>


 8    <artifactId>P1</artifactId>


 9    <groupId>P1</groupId>


10    <version>0.0.1-SNAPSHOT</version>


11   </parent>


12 </project>










AP1Test's pom.xml











 1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

 2   <modelVersion>4.0.0</modelVersion>

 3   <groupId>AP1Test</groupId>

 4   <artifactId>AP1Test</artifactId>

 5   <packaging>apk</packaging>

 6   <version>0.0.1-SNAPSHOT</version>

 7   <parent>

 8    <artifactId>P1</artifactId>

 9    <groupId>P1</groupId>

10    <version>0.0.1-SNAPSHOT</version>

11   </parent>

12   <dependencies>

13    <dependency>

14       <groupId>AP1</groupId>

15       <artifactId>AP1</artifactId>

16       <version>0.0.1-SANPSHOT</version>

17    </dependency>

18    <dependency>

19       <groupId>AP1</groupId>

20       <artifactId>AP1</artifactId>

21       <version>0.0.1-SNAPSHOT</version>

22       <type>apk</type>

23    </dependency>

24   </dependencies>

25 </project>







populating your local repository


For maven to find android dependencies you must populate your local repository. To ease the task you can use android-mvn-install script which do all the hard work for you.
Just run

$ wget -qO - http://android.codtech.com/android-tools/android-mvn-install | bash -s -- --sdk-dir=/opt/android


or download from its page and run it locally.
There's an alternative for this step, maven-android-sdk-deployer, however I prefer the simplicity and flexibility of the android-mvn-install script.

building the project

Now we have several alternatives to build our project:
  • using Eclipse as usual for other Android projects using ADT plugin (i.e.: AP1 -> Run As -> Android Application)
  • using Maven from Eclipse (i.e.: P1 -> Run As -> Maven build)
  • using Maven from the command line (i.e.: mvn install)
  • using a continuous integration tool

using hudson

Having followed all the steps mentioned before we will now be able to create a job in hudson to build our project using maven











conclusion

There are still some rough edges and some things we haven't mentioned yet like running headless android emulators to be able to run the tests on the server. We will be covering these issues in future posts but I think that we have enough already to start applying continuous integration for our android projects.


Comments are gladly welcome.






Copyright © 2010 Diego Torres Milano. All rights reserved.



by Diego Torres Milano ([email protected]) at January 18, 2010 01:00 AM

Mail Box

So a while back my mail man ran over my mail box. So I left it down for several weeks. When I finally got around to putting it back up I decided that this time I would fill it with concrete since the stand is hollow. Needless to say, if he hits it again, he might have a little damage to the truck.

by Wes at January 18, 2010 12:30 AM