Add social sharing icons to your app


I wanted to be able to share selected content in my app to several social media places, and not merely by copy/paste to an email client. Now my app can share contents of a <textarea> field to Facebook, Google+, Google Drive, Dropbox, a memo app, email, and so on. It was easier to do than I thought. Here is how I did it for Android.

This assumes you already have a Cordova project built and Android platform added. (Steps will be slightly different for iOS. I’ll add those steps to this page when I’m ready.)

Resource:
https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin

My current environment:
Mac OS X El Capitan 10.11.6
cordova -v: 6.3.1
cordova platform ?: android 5.1.1 Continue reading

Implementing Crosswalk’s Chromium webview plugin in an Android app


Why consider using Crosswalk? Android devices have different implementations of the webview, in which our PhoneGap and Cordova apps appear. Vendors have made their own tweaks of the webview, causing our code to render inconsistently. So our CSS and scripts will play differently across devices or not at all.

For instance, the HTML5 <video> tag won’t work across all Android browsers:

<video id="video_1" 
 controls preload="auto" width="320" height="240">
 <source src="video/myvideo-h264.mp4" type="video/mp4">
I'm sorry; your device browser doesn't support HTML5 video in MP4 with H.264.
</video>

But it will work in the Chromium webview provided by Crosswalk. By adding the Chromium webview to our app, we will have a unified Android playing field for our app. Continue reading

Displaying a prepopulated database with AngularJS


I am trying out different ways to have a prepopulated database in an app. This time I’m experimenting with AngularJS. The following article show how to display an array of data AngularJS style, filtering the output with two buttons. (This article is not using “ng-cordova.”) If you follow the other articles on this site, you can compare the different approaches for a “simple,” in-app, prepopulated DB. Continue reading

Prepopulated Database with TaffyDB for iOS and Android with Cordova


I thought I would look for an alternate to SQLite to display a prepopulated database. Research (and successfully creating a working version) led me to TaffyDB. Here is a working project to create your own prepopulated DB. TaffyDB can do so much more if you are familiar with JavaScript (I’m not, so it was difficult trying to figure this much out!).

Resources:
http://www.taffydb.com/
http://www.slideshare.net/typicaljoe/better-data-management-using-taffydb-1357773  Continue reading

Adding an Android APK Expansion File to a Cordova Project


Google Play apps are limited to 50MB, but may go larger with “expansion files” of up to 2GB in size. The “main” expansion file is the primary expansion file that contains additional resources required by your application. The “patch” expansion file is optional and intended for small updates to the main expansion file. This article covers how to create and add an expansion file to our Android app using a plugin. Then gives the “secret” way to upload the APK and expansion file to Google Play. Continue reading

Adding ProGuard to Your Android Cordova Project


“The ProGuard tool shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names. The result is a smaller sized .apk file that is more difficult to reverse engineer” (from http://developer.android.com/tools/help/proguard.html). You’ll want to use this tool if your app has sensitive security features you want to protect. To my knowledge, it does not obfuscate your HTML.

These steps assume you’ve already built your Android Cordova project and just about finished it, and are ready to build a release version of the app. Continue reading

Submitting an Android App to Amazon


Are you curious about the process of submitting an app to Amazon? These are the steps I took.

According to Amazon’s developer page at https://developer.amazon.com/public/solutions/devices/fire-tablets, you develop Amazon apps with Android Studio Beta, and your project should build by Gradle. My project was neither of these and it still was accepted. I chose an app already made with Cordova CLI, proofed by Eclipse, signed and zipaligned via CLI, and successfully uploaded to Google Play, and uploaded it to Amazon with just a few graphic asset size changes. Here are the steps I took. Continue reading

Setting Up Your Development Environment for Cordova Android projects


Updated 8/2/2015 to include Windows 7 setup. Adobe PhoneGap/Apache Cordova CLI quickly sets up your project files for the mobile environment. However, it requires a hefty setup of your development environment before you can begin making Android apps. If you are a working developer, all these tools are par for the course and you’ll have them already installed. If you are trying out Cordova/PhoneGap for the first time, and you are new to the programming world – welcome! – you need to install all the “dependencies” that Cordova/PhoneGap assumes are already resident on your system. Follow all these steps to make your Cordova/PhoneGap work go smoothly. Of course, these steps need to be done just once. Continue reading

Notes About Using PhoneGap Build


This is not a tutorial, but a list of things a Cordova PhoneGap developer needs to know if he or she wants to start using PhoneGap Build (PGB). PGB will take your www/ assets and create the files needed for iOS, Android, and Windows devices. It doesn’t use native files, such as those ending in .h, .m, .java, etc.; the build may fail if these are included. What follows are the notes I took as I considered whether to use the service. Read this as a FAQ page for preparing an app for PGB. Curious as to whether PhoneGap Build is for you? Read on…

Main site: https://build.phonegap.com/  Continue reading

App testing with the PhoneGap Developer App — see your changes instantly without re-building!


With this software, you can develop your app on the desktop, then see the changes instantly on your mobile device. There’s no need to re-sign, re-compile, or reinstall your app to test your code. You’ll have access to the device APIs that aren’t available in web browsers. Let’s give it a spin!

For more info:
http://phonegap.com/blog/2014/04/23/phonegap-developer-app/  Continue reading

Installing Chris Brody’s SQLite Database with Cordova CLI (Android)


The HTML5 SQLite spec results in a database with a limit of 5MB. Chris Brody’s SQLitePlugin, however, breaks this barrier. Here is how to implement it. These steps assume you’ve already created the Cordova project and are adding this database project to it. I recommend you build for v19.

 If you just want a simple prepopulated DB, try this article instead. Continue reading

Adding Cordova APIs to Android via CLI: Camera and File APIs – shoot picture and upload to server folder with PHP


In this article, we are continuing our exploration of the Cordova APIs. On this page, we’ll explore the Camera and File APIs to get a photo onto the server. Here, we’ll learn how to upload the image to a server directory after shooting it.

This article requires that you have a server with PHP installed, are able to upload a file to it, and the server accepts uploads. My simple server has a CPanel interface that allowed me to do all of the above. (Don’t worry; I’m going to give you the steps for all of this.)

Continue reading

Cordova-supported WebSQL Database, with user-added data


In this article, we are examining another facet of the database storage, which is built into Cordova. In this article, we’ll create an empty database and allow the user to add records to the database and store them in the device. A button will delete the database. Two outputs are given, one in a text field and one in a table layout. With the text-only layout in the textfield, you can press and hold in the textfield and copy the contents to export it.

Continue reading

Adding Cordova APIs to Android via CLI: File API


In this article, we are in part 4 of exploring the Cordova APIs, which started in https://iphonedevlog.wordpress.com/2014/01/31/adding-cordova-apis-to-android-via-cli-accelerometer-and-camera/ Refer to that article to set up your Cordova PhoneGap project files. You’ll want to follow the “Set Up the Android Project” section through step 9 inclusive. On this page, we’ll explore the File API from the perspective of getting our feet wet.

Continue reading

Adding Cordova APIs to Android via CLI: Geolocation, Globalization, Notification


In this article, we are in part 3 of exploring the Cordova APIs, which started in https://iphonedevlog.wordpress.com/2014/01/31/adding-cordova-apis-to-android-via-cli-accelerometer-and-camera/ Refer to that article to set up your Cordova PhoneGap project files. You’ll need to follow the “Set Up the Android Project” section through step 9 inclusive. On this page, we’ll explore the Geolocation, Globalization, Notification APIs from the perspective of getting our feet wet. Continue reading

Adding Cordova APIs to Android via CLI: Compass, Connection, Device


In this article, we are in part 2 of exploring the Cordova APIs, which started in https://iphonedevlog.wordpress.com/2014/01/31/adding-cordova-apis-to-android-via-cli-accelerometer-and-camera/ Refer to that article to set up your Cordova PhoneGap project files. You’ll need to follow the “Set Up the Android Project” section through step 9 inclusive. On this page, we’ll explore the Compass, Connection, and Device APIs. Continue reading

Adding Cordova APIs to Android via CLI: Accelerometer and Camera


In this beginner’s article, we’ll see what’s involved in adding the Cordova APIs to an PhoneGap Android project. It was written to help get your feet wet in case you’ve never tried it. An API (application programming interface) will allow us to use the features of the smartphone, such as accelerometer, camera, com
pass, and other features. In the case of Cordova’s PhoneGap, this APIs come in the form of plugins. They need to be added to the project on an as-needed basis.

Continue reading

Using Git Versioning Control Locally


You can add a versioning control system to track and manage your project’s assets with Git locally — you don’t need to upload it to git.com. Here’s how.

Downloading Git

Download Git from http://git-scm.com. It will detect your OS and provide the correct download for it. For my Mac, it was version 1.8.3.2.

The Mac version downloaded a dmg file to my Downloads folder. Double-click to open it, then double-click on the pkg file. (If your preferences prevent you from opening a file from an unidentified developer, then hold down Control, right-click on the pkg icon, and select open.) The Installer should appear; click to continue through the few steps, including providing your admin password. You’ll find a drive icon for the Git dmg package; right-click and select to Eject. (I believe “dmg” is short for “disc image.”)  Continue reading

Easily Add Search Functions to Your App


I have been adding a Search function to my Cordova PhoneGap apps for a few years now. It is so easy that I want to share it with you who have wondered how to do the same. I use a product that works in Windows, and it creates a search database of all words in the HTML pages using Javascript. I’m using Zoom Search Engine 6.0 Professional Edition, available from http://www.wrensoft.com/zoom/Continue reading

Using PhoneGap 3.0 CLI on Mac OS X to Build iOS and Android Projects


At the time this was written PhoneGap Build does not support PG 3.0. These instructions assume Cordova PhoneGap is being used, not Build.

I highly recommend following the latest version of PhoneGap or Cordova. For instance, try these pages:

iOS: https://iphonedevlog.wordpress.com/2014/06/24/using-cordova-3-5-cli-on-mac-os-x-mavericks-to-build-ios-apps/

Android: https://iphonedevlog.wordpress.com/2014/06/20/using-cordova-3-5-cli-on-mac-os-x-mavericks-to-build-android-apps/

In this article, you will use CLI to build iOS and Android projects:

  • Install Cordova
  • Create a project with all necessary www folders and files
  • Add iOS and Android platform version folders and files
  • Build an Android debug apk for installation on a device for previewing
  • Build an Android project and view on a browser for previewing
  • Add the InAppBrowser and Splashscreen plugins
  • Update icons and splash screens for each platform
  • Update the config.xml, AndroidManifest.xml, and index.html files
  • Customize content for a particular platform
  • Finalize a product apk for Google Play upload, including keys and certificates

Continue reading