Some demos of multiple cordova/ionic plugins using the Crosswlak project as default WebView.
Ionic provide great documentation for each side of the project:
First, install Node.js. Then, install the latest Cordova and Ionic command-line tools. Follow the Android and iOS platform guides to install required platform dependencies.
Note: iOS development requires Mac OS X. iOS simulator through the Ionic CLI requires the ios-sim npm package, which can be installed with the command
npm -g install ios-sim
. If you want to deploy your app on a real iOS device install ios-deploy with the commandnpm -g install ios-deploy
.
The basic app start for Ionic is well documented here and by read the Ionic CLI help with ionic --help
. But this is a good start for me:
$ ionic start -sass ionicCordovaPluginsDemo sidemenu
Update Ionic library files, which are found in the www/lib/ionic
directory. If bower is being used
by the project, this command will automatically run bower update ionic
, otherwise this command updates
the local static files from Ionic’s CDN.
$ ionic lib update
To run & debug your application easily on Android devices, you have to install the Android SDK. The android-sdk
package could be easily installed with brew, but not android-platform-tools
(which is the tricky part).
First make sure you have your brew list updated, then install the android-sdk
package.
$ brew update
$ brew install android-sdk
If you run ionic run android --device
it will make an error like:
ERROR: Error: Please install Android target: "android-22".
Hint: Open the SDK manager by running: /usr/local/Cellar/android-sdk/24.2/bin/android
You will require:
1. "SDK Platform" for android-22
2. "Android SDK Platform-tools (latest)
3. "Android SDK Build-tools" (latest)
To solve this you have to install required SDK by selecting them using:
$ android
If you have planed to use Google services (G+/Oauth/Google Play), you have to install these packages:
- Android Support Repository
- Android Support Library
- Google Play services
- Google Repository
- Google Play APK Expansion Library
Enable the liveReload and the log on the device (Ionic CLI options):
ionic run android --device -l -c
This is the list of all plugins used in the project:
- cordova-plugin-device [github]
- cordova-plugin-console [github]
- cordova-plugin-whitelist [github]
- cordova-plugin-splashscreen [github]
- cordova-plugin-statusbar [github]
- ionic-plugin-keyboard [github]
- cordova-plugin-camera [github]
- cordova-plugin-file-transfer [github]
- cordova-plugin-file [github]
- com.hutchind.cordova.plugins.streamingmedia [github]
- cordova-plugin-x-socialsharing [github]
- cordova-plugin-dialogs [github]
- cordova-plugin-x-toast [github]
- cordova-plugin-inappbrowser [github]
- cordova-plugin-media-capture [github]
- cordova-plugin-crosswalk-webview [github]
- cordova-plugin-googleplus [github]
- cordova-plugin-network-information [github]
- phonegap-plugin-push [github]
- cordova-plugin-facebook4 [github]
- com.jareddickson.cordova.tag-manager [github]
- cc.fovea.cordova.purchase [github]
To generate a release build for Android, we can use the following cordova cli command:
$ cordova build --release android
This will generate a release build based on the settings in your config.xml
. Your Ionic app will have preset default values in this file, but if you need to customize how your app is built, you can edit this file to fit your preferences. Check out the config.xml
file documentation for more information.
Next, we can find our unsigned APK file in platforms/android/build/outputs/apk
. Now, we need to sign the unsigned APK and run an alignment utility on it to optimize it and prepare it for the app store. If you already have a signing key, skip these steps and use that one instead.
Let’s generate our private key using the keytool command that comes with the JDK. If this tool isn’t found, refer to the installation guide:
$ keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
You’ll first be prompted to create a password for the keystore. Then, answer the rest of the nice tools’s questions and when it’s all done, you should have a file called my-release-key.keystore
created in the current directory.
Note: Make sure to save this file somewhere safe, if you lose it you won’t be able to submit updates to your app!
To sign the unsigned APK, run the jarsigner
tool which is also included in the JDK:
$ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore HelloWorld-release-unsigned.apk alias_name
This signs the apk in place. Finally, we need to run the zip align tool to optimize the APK. The zipalign tool can be found in /path/to/Android/sdk/build-tools/VERSION/zipalign
:
$ zipalign -v 4 HelloWorld-release-unsigned.apk HelloWorld.apk
Now we have our final release binary called HelloWorld.apk and we can release this on the Google Play Store for all the world to enjoy!
There is multiple ways of doing automation tests:
- unit testing
- integration tests
- e2e tests
Appium is an open source test automation framework for use with native, hybrid and mobile web apps. It drives iOS and Android apps using the WebDriver protocol.
We use Protractor to lunch and config Appium for testing purpose, so make sure you have these installed:
$ npm install -g protractor appium
To be sure Appium is ready, run this command (and fix what needs to be fixed):
$ appium-doctor
You can start Appium by running:
$ appium
Then you can start the Protactor file with:
$ protractor protractor-config.js
To avoid some problems using the Facebook SDK, try to always verify the SDK version, in sort of always use the last version. The phonegap-facebook-plugin
from Wizcorp don't use (currently) the last Facebook SDK version.
Instead, cordova-plugin-facebook4
from Jeduan is a fork of the Wizcorp plugin with the latest SDK version.