-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Cordova framework to build Android app #1946
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,14 +48,15 @@ Unstable testing versions of the lates builds of the configurator for most platf | |
|
|
||
| **Be aware that these versions are intended for testing / feedback only, and may be buggy or broken, and can cause flight controller settings to be corrupted. Caution is advised when using these versions.** | ||
|
|
||
| ## Native app build via NW.js | ||
| ## Native app build via NW.js (windows/linux/macos) or Cordova (android) | ||
|
|
||
| ### Development | ||
|
|
||
| 1. Install node.js (version 10 required) | ||
| 2. Install yarn: `npm install yarn -g` | ||
| 3. Change to project folder and run `yarn install`. | ||
| 4. Run `yarn start`. | ||
| 3. (For Android platform only) Install Java JDK 8, Gradle and Android Studio (Android SDK at least level 19) | ||
| 4. Change to project folder and run `yarn install`. | ||
| 5. Run `yarn start`. | ||
|
|
||
| ### Running tests | ||
|
|
||
|
|
@@ -69,12 +70,14 @@ yarn gulp <taskname> [[platform] [platform] ...] | |
| ``` | ||
|
|
||
| List of possible values of `<task-name>`: | ||
| * **dist** copies all the JS and CSS files in the `./dist` folder. | ||
| * **dist** copies all the JS and CSS files in the `./dist` folder [2]. | ||
| * **apps** builds the apps in the `./apps` folder [1]. | ||
| * **debug** builds debug version of the apps in the `./debug` folder [1]. | ||
| * **debug** builds debug version of the apps in the `./debug` folder [1][3]. | ||
| * **release** zips up the apps into individual archives in the `./release` folder [1]. | ||
|
|
||
| [1] Running this task on macOS or Linux requires Wine, since it's needed to set the icon for the Windows app (build for specific platform to avoid errors). | ||
| [2] For Android platform, **dist** task will generate the `./cordova` folder | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nitpick - this does not seem to be true any more - probably rather 'or Android platform, dist task will generate folders and files in the A cleaner way to do this would be to have these files generated under
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can rename the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Part of the problem is that the statement 'For Android platform, dist task will generate the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @WalcoFPV: I think this needs to be fixed with some urgency, and it is a little bit more complex than previously thought: This is a hassle and will require a lot of manual cleanup in the future, so it should be fixed - probably best rename the files to
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done ! #2109 |
||
| [3] For Android platform, you need to configure an emulator or to plug an Android device with USB debugging enabled | ||
|
|
||
| #### Build or release app for one specific platform | ||
| To build or release only for one specific platform you can append the plaform after the `task-name`. | ||
|
|
@@ -84,6 +87,7 @@ If no platform is provided, all the platforms will be done in sequence. | |
| * **Linux** use `yarn gulp <task-name> --linux64` | ||
| * **Windows** use `yarn gulp <task-name> --win32` | ||
| * **ChromeOS** use `yarn gulp <task-name> --chromeos` | ||
| * **Android** use `yarn gulp <task-name> --android` | ||
|
|
||
| You can also use multiple platforms e.g. `yarn gulp <taskname> --osx64 --linux64`. | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "android": { | ||
| "release": { | ||
| "keystore": "release.keystore", | ||
| "storePassword": "betaflight", | ||
| "alias": "betaflight", | ||
| "password" : "betaflight" | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <widget xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="com.betaflight.betaflightconfigurator" version="[INJECTED_BY_GULPFILE]"> | ||
| <name>[INJECTED_BY_GULPFILE]</name> | ||
| <description>[INJECTED_BY_GULPFILE]</description> | ||
| <author href="https://betaflight.com">[INJECTED_BY_GULPFILE]</author> | ||
| <content src="main_cordova.html"/> | ||
| <access origin="*"/> | ||
| <allow-intent href="http://*/*"/> | ||
| <allow-intent href="https://*/*"/> | ||
| <allow-intent href="tel:*"/> | ||
| <allow-intent href="sms:*"/> | ||
| <allow-intent href="mailto:*"/> | ||
| <allow-intent href="geo:*"/> | ||
| <preference name="Orientation" value="default"/> | ||
| <preference name="ShowSplashScreenSpinner" value="false"/> | ||
| <preference name="AutoHideSplashScreen" value="false"/> | ||
| <platform name="android"> | ||
| <allow-intent href="market:*"/> | ||
| <icon src="resources/android/icon/drawable-ldpi-icon.png" density="ldpi"/> | ||
| <icon src="resources/android/icon/drawable-mdpi-icon.png" density="mdpi"/> | ||
| <icon src="resources/android/icon/drawable-hdpi-icon.png" density="hdpi"/> | ||
| <icon src="resources/android/icon/drawable-xhdpi-icon.png" density="xhdpi"/> | ||
| <icon src="resources/android/icon/drawable-xxhdpi-icon.png" density="xxhdpi"/> | ||
| <icon src="resources/android/icon/drawable-xxxhdpi-icon.png" density="xxxhdpi"/> | ||
| <splash src="resources/android/splash/drawable-land-hdpi-screen.png" density="land-hdpi"/> | ||
| <splash src="resources/android/splash/drawable-land-ldpi-screen.png" density="land-ldpi"/> | ||
| <splash src="resources/android/splash/drawable-land-mdpi-screen.png" density="land-mdpi"/> | ||
| <splash src="resources/android/splash/drawable-land-xhdpi-screen.png" density="land-xhdpi"/> | ||
| <splash src="resources/android/splash/drawable-land-xxhdpi-screen.png" density="land-xxhdpi"/> | ||
| <splash src="resources/android/splash/drawable-land-xxxhdpi-screen.png" density="land-xxxhdpi"/> | ||
| <splash src="resources/android/splash/drawable-port-hdpi-screen.png" density="port-hdpi"/> | ||
| <splash src="resources/android/splash/drawable-port-ldpi-screen.png" density="port-ldpi"/> | ||
| <splash src="resources/android/splash/drawable-port-mdpi-screen.png" density="port-mdpi"/> | ||
| <splash src="resources/android/splash/drawable-port-xhdpi-screen.png" density="port-xhdpi"/> | ||
| <splash src="resources/android/splash/drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/> | ||
| <splash src="resources/android/splash/drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/> | ||
| <preference name="SplashMaintainAspectRatio" value="true"/> | ||
| <preference name="SplashShowOnlyFirstTime" value="true"/> | ||
| <preference name="android-minSdkVersion" value="19"/> | ||
| <config-file parent="/manifest/application/activity" target="AndroidManifest.xml"> | ||
| <intent-filter> | ||
| <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"/> | ||
| </intent-filter> | ||
| <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/usb_device_filter"/> | ||
| </config-file> | ||
| <resource-file src="usb_device_filter.xml" target="app/src/main/res/xml/usb_device_filter.xml"/> | ||
| </platform> | ||
| <platform name="ios"> | ||
| <allow-intent href="itms:*"/> | ||
| <allow-intent href="itms-apps:*"/> | ||
| </platform> | ||
| </widget> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| { | ||
| "name": "[INJECTED_BY_GULPFILE]", | ||
| "displayName": "Betaflight Configurator", | ||
| "version": "[INJECTED_BY_GULPFILE]", | ||
| "description": "[INJECTED_BY_GULPFILE]", | ||
| "main": "index.js", | ||
| "scripts": {}, | ||
| "author": "[INJECTED_BY_GULPFILE]", | ||
| "license": "[INJECTED_BY_GULPFILE]", | ||
| "dependencies": { | ||
| "cordova": "^9.0.0", | ||
| "cordova-android": "^8.1.0", | ||
| "cordova-clipboard": "^1.3.0", | ||
| "bf-cordova-open-native-settings": "^2.0.4", | ||
| "bf-cordova-plugin-appavailability": "^1.0.3", | ||
| "cordova-plugin-chrome-apps-common": "^1.0.7", | ||
| "cordova-plugin-chrome-apps-runtime": "^2.0.0", | ||
| "cordova-plugin-chrome-apps-storage": "^1.0.4", | ||
| "bf-cordova-plugin-chrome-apps-usb": "^2.0.1", | ||
| "cordova-plugin-dialogs": "^2.0.2", | ||
| "cordova-plugin-file": "^6.0.2", | ||
| "cordova-plugin-filechooser": "^1.2.0", | ||
| "cordova-plugin-market": "^1.2.0", | ||
| "cordova-plugin-permission": "^0.1.0", | ||
| "cordova-plugin-splashscreen": "^5.0.3", | ||
| "cordova-plugin-usb-event": "^1.0.2", | ||
| "cordova-plugin-whitelist": "^1.3.4", | ||
| "bf-cordovarduino": "^1.0.0" | ||
| }, | ||
| "cordova": { | ||
| "platforms": [ | ||
| "android" | ||
| ], | ||
| "plugins": { | ||
| "cordova-plugin-chrome-apps-common": {}, | ||
| "cordova-plugin-chrome-apps-runtime": {}, | ||
| "cordova-plugin-chrome-apps-storage": {}, | ||
| "cordova-plugin-whitelist": {}, | ||
| "cordova-plugin-splashscreen": {}, | ||
| "cordova-plugin-permission": {}, | ||
| "cordova-plugin-usb-event": {}, | ||
| "cordova-plugin-dialogs": {}, | ||
| "bf-cordovarduino": {}, | ||
| "cordova-plugin-file": {}, | ||
| "cordova-plugin-filechooser": {}, | ||
| "bf-cordova-plugin-chrome-apps-usb": {}, | ||
| "cordova-clipboard": {}, | ||
| "cordova-plugin-screen-orientation": {}, | ||
| "cordova-plugin-market": {}, | ||
| "bf-cordova-open-native-settings": {}, | ||
| "bf-cordova-plugin-appavailability": {} | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <resources> | ||
| <usb-device vendor-id="1155" product-id="22336" /> <!--STMicroelectronics / Virtual COM Port --> | ||
| </resources> |

Uh oh!
There was an error while loading. Please reload this page.