Download E-books 20 Recipes for Programming PhoneGap: Cross-Platform Mobile Development for Android and iPhone PDF

By Jamie Munro

Gain hands-on event with the superb PhoneGap library, utilizing the sensible recipes during this convenient advisor. With those recommendations, you could allow your cellular net apps to engage with device-specific gains resembling the accelerometer, GPS, digital camera, and handle booklet. how you can use your wisdom of HTML, CSS, and JavaScript to construct complete cellular apps for iOS, Android, and a number of other systems with no rewriting apps within the local platform language. every one recipe comprises pattern code you should use on your venture right now, in addition to a dialogue of why the answer works.

  • Add performance that’s to be had simply on a undeniable equipment or platform
  • Retrieve the device’s present GPS place and position a marker on a map
  • Create and store a brand new touch or edit an current touch within the handle book
  • Take images with the digital camera or choose one of many user’s current photos
  • Upload a dossier from the neighborhood machine to an exterior server
  • Allow the gadget to list audio or video via your app
  • Enable your program to avoid wasting documents locally

Show description

Read Online or Download 20 Recipes for Programming PhoneGap: Cross-Platform Mobile Development for Android and iPhone PDF

Similar Programming books

Working Effectively with Legacy Code

Get extra from your legacy structures: extra functionality, performance, reliability, and manageability Is your code effortless to alter? are you able to get approximately instant suggestions if you do swap it? Do you realize it? If the reply to any of those questions is not any, you might have legacy code, and it's draining time and cash clear of your improvement efforts.

Clean Code: A Handbook of Agile Software Craftsmanship

Even undesirable code can functionality. but when code isn’t fresh, it may well deliver a improvement association to its knees. each year, numerous hours and important assets are misplaced as a result of poorly written code. however it doesn’t must be that manner. famous software program specialist Robert C. Martin provides a innovative paradigm with fresh Code: A instruction manual of Agile software program Craftsmanship .

Implementation Patterns

“Kent is a grasp at developing code that communicates good, is straightforward to appreciate, and is a excitement to learn. each bankruptcy of this ebook comprises first-class causes and insights into the smaller yet very important judgements we regularly need to make while growing caliber code and periods. ” –Erich Gamma, IBM individual Engineer   “Many groups have a grasp developer who makes a speedy movement of excellent judgements all day lengthy.

Agile Testing: A Practical Guide for Testers and Agile Teams

Te>Two of the industry’s such a lot skilled agile trying out practitioners and experts, Lisa Crispin and Janet Gregory, have teamed as much as convey you the definitive solutions to those questions and so on. In Agile trying out, Crispin and Gregory outline agile checking out and illustrate the tester’s function with examples from actual agile groups.

Additional resources for 20 Recipes for Programming PhoneGap: Cross-Platform Mobile Development for Android and iPhone

Show sample text content

Json. JSONException; import android. util. Log; import com. phonegap. api. Plugin; import com. phonegap. api. PluginResult; Extending PhoneGap with Plug-ins | fifty five import com. phonegap. api. PluginResult. prestige; public category XmlParserPlugin extends Plugin { @Override public PluginResult execute(String motion, JSONArray info, String callbackId) { try out { String feedUrl = information. getString(0); extractXMLContent(feedUrl, callbackId); } seize (JSONException e) { go back new PluginResult(Status. errors, "Error parsing URL"); } PluginResult r = new PluginResult( PluginResult. prestige. NO_RESULT); r. setKeepCallback(true); go back r; } public void extractXMLContent(String feedUrl, String callbackId) { AndroidSaxFeedParser parser = new AndroidSaxFeedParser(feedUrl); JSONArray messages = parser. parse(); if (messages. length() > zero) { Log. d("parse", "Sending okay consequence, with messages"); PluginResult r = new PluginResult( prestige. okay, messages); r. setKeepCallback(true); success(r, callbackId); } else { Log. e("parse", "No effects chanced on, sending blunders message"); PluginResult r = new PluginResult( prestige. errors, "No results"); r. setKeepCallback(true); error(r, callbackId); } } } I won’t cross into an excessive amount of element in regards to the Java code simply because i need to target what’s had to create the plug-in. The previous instance comprises a number of very important statements to supply entry to the PhoneGap Plug-in API. as the Plugin category is being prolonged, the execute functionality has to be overridden. This acts because the touchdown functionality while the plug-in is termed through JavaScript. The go back form of the execute functionality is a PluginResult item. because the XML parsing may be performed asynchronously, successful prestige can't be handed again but. in its place, the fifty six | The Recipes extractXMLContent is named, which while accomplished will go back a hit or mistakes message. to prevent blocking off the execution of the JavaScript name, a NO_RESULT prestige is re- grew to become. contained in the extractXMLContent functionality, a brand new SAX parser is created utilizing the feedUrl that was once handed in. To create the SAX parser, I leveraged a code instance from the IBM developer website. within the unique instance, an array of sophistication Message is back. as the PluginRe sult can in basic terms be a String, JSONArray, or JSONObject, I up-to-date the code to come a JSONArray of JSONObject gadgets. back, I’ll gloss over the Java code to target the plug-in itself. as soon as the parsing is entire, if the JSONArray includes no components, an mistakes prestige is distributed again to the JavaScript; in a different way, successful message is shipped again besides the results of messages. This completes the construction of the plug-in. in the event you plan to unlock the plug-in, it is important to collect it right into a jar dossier. this is often performed through the jar software. another way, you could easily reproduction the package deal into your current PhoneGap venture src folder. when you decide to jar your plug-in, it is important to upload it in your libs folder and replace the construct Configuration to incorporate it an analogous manner you first incorporated the telephone hole. jar dossier. if you want to manage to collect and try this code, please obtain the entire resource code from the URL supplied within the preface.

Rated 4.32 of 5 – based on 43 votes