Notes on v 3.4.0:
Make all of your changes in the parent directory that all platforms will reference. Then build your code for the specific platform. Here's a nice shortcut:
cordova emulate –target=“ipad (retina)”
will rebuild the code, then run on the simulator
cordova run ios
will rebuild the code, the load on the device. Because of a bug you need to run the app on the device manually.
- If things aren't rebuilding right regarding plugins,this script might help
- can we just forget about PG and use Cordova only?
Disable status bar:
- phonegap local plugin add https://github.com/phonegap-build/StatusBarPlugin.git
- view these docs
- bizarrely, the plugin successfully hides the status bar but reports it still visible?
Get console log info:
- phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git
Know what device you are on:
- cordova plugin add org.apache.cordova.device
Media:
- cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-media.git
- cordova plugin add org.apache.cordova.file (yes you need this for media to work or you get a CDVfile error not found)
Pause Event (iOS):
- console.log actually does work on a pause event
- both sessionStorage and localStorage will not be called on a pause event until after the resume
- fileAPI (native plugin) will not be called on pause event consistently until after resume
Storage:
- localStorage will persist of app is killed, but sessionStorage will not
- both localStorage and sessionStorage have a quota of 5MB on iOs
Updating Plugins
cordova-update-plugins is a plugin to check and optionally make sure all plugins are updated:
- install: sudo npm install -g cordova-check-plugins
- check: cordova-check-plugins
- update: cordova-check-plugins –update=auto
Running on Android
- To accept licenses:
Creating a release version: Android
This process (keytool, jarsigner, zipalign) was still required as of Cordova 9.0 April 2020
generate keystore file if it doesn't already exist. In the root directory of the project (parent of www): “keytool -genkey -v -keystore <APPNAME>.keystore -alias <APPNAME> -keyalg RSA -keysize 2048 -validity 10000” edit /platforms/android/AndroidManifest.xml so that debuggable is set to false
- update: as of Cordova 5.x you can't hardcode debuggable anymore. If you really want to (for example debuggable = true with release (for inapp purchase testing)) edit platforms/android/build.gradleand add in the android { section:
lintOptions { checkReleaseBuilds false }
- note: you must use the same keystore file for all versions of the same app
To build for release: “cordova build android –release”
As of Cordova 5 you seem to need to run the keysigner separately. The keysigner will sign an existing file. It does not write a new file:
- Format: jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore <APPNAME>.keystore <PATH_TO_APK_FILE>.apk <APPNAME>
- Example: jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ~/SnappyKids/lavaLevel/lavaLevel.keystore android-armv7-release-unsigned.apk lavaLevel
After running the jarsigner it is necessary to run the zip align tool:
- Format: zipalign -v 4 <signed.apk> <zip-aligned-signed-apk>
- Example: /home/user/dev/android-sdk-linux/build-tools/23.0.1/zipalign -v 4 platforms/android/build/outputs/apk/android-release-signed.apk platforms/android/build/outputs/apk/android-release.apk
Splash Screen
- Generate Automatically: http://ticons.fokkezb.nl/