-
Notifications
You must be signed in to change notification settings - Fork 62
Cordova Mobile Spec Test (Obsoleted)
Currently, we use code @3.0.0 tag.
Please refer to Setup Development Environment if it is not ready.
We use plugman
to install plugins. Please refer to Using Plugman to Manage Plugins. Install it via:
$ npm install -g plugman
Fetch [email protected]
$ git clone [email protected]:apache/cordova-mobile-spec.git
$ cd cordova-mobile-spec
$ git checkout -b 3.0.0 3.0.0
Create mobile spec app:
$ [path_to_cordova_xwalk_android]/bin/create mobilespec org.apache.mobilespec mobilespec
$ cd mobilespec
$ cp -r [path_to_cordova-mobile-spec]/* assets/www
$ cp -r [path_to_cordova-mobile-spec]/config.xml res/xml/config.xml
Install API [email protected] from upstream repos:
$ cd [path_to_mobilespec]
$ plugman install --platform android --project ./ --plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git#3.0.0
$ plugman install --platform android --project ./ --plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information.git#3.0.0
$ plugman install --platform android --project ./ --plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status.git#3.0.0
$ plugman install --platform android --project ./ --plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion.git#3.0.0
$ plugman install --platform android --project ./ --plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation.git#3.0.0
$ plugman install --platform android --project ./ --plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git#3.0.0
$ plugman install --platform android --project ./ --plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-media.git#3.0.0
$ plugman install --platform android --project ./ --plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-file.git#3.0.0
$ plugman install --platform android --project ./ --plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer.git#3.0.0
$ plugman install --platform android --project ./ --plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git#3.0.0
$ plugman install --platform android --project ./ --plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen.git#3.0.0
$ plugman install --platform android --project ./ --plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git#3.0.0
$ plugman install --platform android --project ./ --plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git#3.0.0
$ plugman install --platform android --project ./ --plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture.git#3.0.0
$ plugman install --platform android --project ./ --plugin assets/www/cordova-plugin-whitelist
Globalization plugin @3.0.0 has a lot of failures. Recommend to use r0.2.3:
$ plugman install --platform android --project ./ --plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization.git#r0.2.3
Vibration plugin @3.0.0 has permission setting issue. Recommend to use r0.3.0:
$ plugman install --platform android --project ./ --plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration.git#r0.3.0
Since contacts and inappbrowser plugin @3.0.0 has issues with Crosswalk-based Cordova Android, please install the compatible version:
$ cd [path_to_mobilespec]
$ plugman install --platform android --project ./ --plugin https://github.com/otcshare/cordova-plugin-contacts.git#3.0.0_patched
$ plugman install --platform android --project ./ --plugin https://github.com/otcshare/cordova-plugin-inappbrowser.git#3.0.0_patched
According to Splash Screen API Spec, you may need to add following statement into the onCreate
method of the class that extends DroidGap
:
super.setIntegerProperty("splashscreen", R.drawable.splash);
You may need to enable the Remote Debugging
Finally, Build and Run:
$ cd [path_to_mobilespec]
$ ./cordova/build
$ ./cordova/run
[Nexus 7 Android 4.3] (Mobile-Spec-Test-Results-Nexus-7-Android-4.3)
[Geek Android 4.2.2] (Mobile-Spec-Test-Results-Geek-Android-4.2.2)
[Sansung Galaxy Tab3 Android 4.2.2] (Mobile-Spec-Test-Results-Galaxy-Tab3-Android-4.2.2)
- If the cordova geolocation plugin was add to mobile spec app, the built-in navigator.geolocation object will be replaced by the geolocation plugin javascript stub code. In this case, the geolocation request will be processed by the plugin even if we chose built-in WebView navigator.geolocation test.
- The cordova geolocation plugin could not switch between GPS and Network providers automatically. Developers must specify the GPS/Network provider with the boolean argument enableHighAccuracy for geolocation.getCurrentPosition() API.
The mobile spec uses GPS for geolocation test by default. If we want to use network provider, we have to make enableHighAccuracy false at line 99 in [mobile_spec_app_path]/assets/www/location/index.html