Cross-platform App with PhoneGap - Henri Mägi

1,325 views

Published on

Henri Mägi - Mobile Software Engineer @ Mooncascade

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,325
On SlideShare
0
From Embeds
0
Number of Embeds
743
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Cross-platform App with PhoneGap - Henri Mägi

  1. 1. CROSS-PLATFORM APP WITHPHONEGAPHenri Mägi
  2. 2. HISTORY• 2008 at an iPhoneDevCamp event in San Francisco• Adobe officially announced the acquisition of Nitobi Software(the original developer) on October 4, 2011• Coincident with that, the PhoneGap code was contributed tothe Apache Software Foundation to start a new project calledApache Cordova.
  3. 3. WHAT IS PHONEGAP?Wrap it withPhoneGapDeploy to mobileplatforms
  4. 4. PLATFORMS• iOS• Android• Blackberry• WebOS• Windows Phone 7+8• Symbian• Bada
  5. 5. FEATURES• Accelerometer• Camera• Compass• Contacts• File• Geolocation• Media• Network• Notifications• Storage
  6. 6. SAMPLE CODE SNIPPET• Platform specific config.xmlin IOS: <plugin name="Accelerometer" value="CDVAccelerometer" />• Javascript:function onSuccess(acceleration) {alert(Acceleration X: + acceleration.x + n +Acceleration Y: + acceleration.y + n +Acceleration Z: + acceleration.z + n +Timestamp:      + acceleration.timestamp + n);};function onError() {alert(onError!);};navigator.accelerometer.getCurrentAcceleration(onSuccess, onError);
  7. 7. CUSTOM PLUGINS• Javascript:exec(<successFunction>, <failFunction>, <service>, <action>, [<args>]);• Platform specific xml config<plugin name="service_name" value="PluginClassName" />• iOS:(void)myMethod:(CDVInvokedUrlCommand*)command{CDVPluginResult* pluginResult = nil;NSString* myarg = [command.arguments objectAtIndex:0];if (myarg != nil) {pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];} else {pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERRORmessageAsString:@"Arg was null"];}[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];}
  8. 8. APP’S USING PHONEGAP
  9. 9. TINYTERRORS
  10. 10. WHENTO USE?• Multiple Platforms• Access basic native functionality• Offline usage• Not proficient in target platform• Simple apps
  11. 11. WHEN NOT?• Data Processing• Background Processing• Access advanced native functionality• Complex Business Logic• Advanced Graphics
  12. 12. THANKYOU!• Special thanks goes to Priit Salumaa• Mooncascade• Fortumo• Department of Business Development atTartu CityGovernment• Questions??

×