refact Phonegap 2