porting of iOS part to phonegap 3.1