Skip to content

Commit

Permalink
feat(android): android platform release preparation
Browse files Browse the repository at this point in the history
Added a test:android command and android support for gen-tests as well as additions to the readme
explaining how to setup the Android testing environment.

NA
  • Loading branch information
willhay committed Jul 6, 2016
1 parent 8663b66 commit 2d60614
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"timestamp-platform-tests": "cd ../cordova-plugin-test-projects/cordova-plugin-qrscanner-tests && replace '{{TIMESTAMP}}' `timestamp`",
"install-platform-tests": "cd ../cordova-plugin-test-projects/cordova-plugin-qrscanner-tests && npm install",
"test:ios": "cd ../cordova-plugin-test-projects/cordova-plugin-qrscanner-tests && npm run test:ios",
"test:android": "cd ../cordova-plugin-test-projects/cordova-plugin-qrscanner-tests && npm run test:android",
"test:browser": "cd ../cordova-plugin-test-projects/cordova-plugin-qrscanner-tests && npm run test:browser",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s"
},
Expand Down
9 changes: 9 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,14 @@ While the browser implementation matches the native mobile implementations very

The browser implementation of this plugin is designed to abstract these platform differences very thoroughly. It's recommended that you focus your development efforts on implementing this plugin well for one of the mobile platform, and the browser platform implementation will degrade gracefully from there.

## Android

Before testing with Android, please install [Java Development Kit (JDK) 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html), [Android Studio](https://developer.android.com/studio/index.html), and the SDK packages for whatever [API level](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) you wish to target.

Cordova's CLI tools require some environment variables to be set in order to function correctly. The CLI will attempt to set these variables for you, but in certain cases you may need to set them manually. Please refer to [Cordova's Android Platform Guide](https://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html) for more information.

Please make sure you have Gradle updated. If you get an error stating "Gradle Version 2.10 is required", ensure you selected `Use default Gradle wrapper` when Android Studio started up. Then edit the `Project/gradle/wrapper/gradle-wrapper.properties` file and change the distributionUrl line to `distributionUrl=http\://services.gradle.org/distributions/gradle-2.10-all.zip`.

### Video Preview DOM Element

Unlike the other platforms, it's not possible to spawn the `<video>` preview behind the `<html>` and `<body>` using only Javascript. Trying to mimick the effect by making the element a sibling to either the `<html>` or `<body>` elements also produces inconsistent results (ie: no rendering on Chromium). Instead, this plugin appends the `<video>` element as the final child of the `<body>` element, and applies styling to cover the entire background.
Expand Down Expand Up @@ -371,6 +379,7 @@ This will create a new cordova project in the `cordova-plugin-test-projects` dir

- `npm run test:ios`
- `npm run test:browser`
- `npm run test:android`

Both Automatic Tests (via Cordova Plugin Test Framework's built-in [Jasmine](https://github.com/jasmine/jasmine)) and Manual Tests are available. Automatic tests confirm the existence and expected structure of the javascript API, and manual tests should be used to confirm functionality on each platform.

Expand Down
3 changes: 2 additions & 1 deletion tests/project/config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="test.qrscanner.{{TIMESTAMP}}" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="test.qrscanner.t{{TIMESTAMP}}" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>CvQRScnTst</name>
<description>
A test application for the cordova-plugin-qrscanner package.
Expand Down Expand Up @@ -29,4 +29,5 @@
<plugin name="cordova-plugin-test-framework" spec="~1.1.2" />
<engine name="browser" spec="~4.1.0" />
<engine name="ios" spec="~4.1.1" />
<engine name="android" spec="~5.1.1" />
</widget>
3 changes: 2 additions & 1 deletion tests/project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"clean": "rm -rf node_modules && rm -rf platforms && rm -rf plugins",
"postinstall": "cordova prepare",
"test:ios": "cordova build ios && open platforms/ios/CvQRScnTst.xcodeproj",
"test:browser": "cordova run browser"
"test:browser": "cordova run browser",
"test:android": "cordova build android && open -a /Applications/Android\\ Studio.app platforms/android"
},
"private": true,
"dependencies": {
Expand Down

0 comments on commit 2d60614

Please sign in to comment.