Revised according to recent API change.

Note: I haven't checked the iOS folder yet but I believe it should have similar changes on API.   But this patch works for Cordova / Phonegap 2.0 + on Android now.