Cordova

From Logic Wiki
Jump to: navigation, search


https://upgradetoangular.com/angular-mobile-app/how-to-build-an-android-app-with-angular/

https://cordova.apache.org/

Prerequisites

Setup your platform: Android Studio or Mac Xcode


Build an Android app with Angular

Install Cordova = Open a command prompt and type '

npm install -g cordova'

Create a project = Navigate to the directory where you wish to create your project and type

cordova create getting-started-app

Add a platform = Navigate to the project directory and add a platform by typing

cordova platform add android

Run your app = From the command line, type

cordova run android

Build your Angular app = Navigate to your project directory and type

ng build --prod

Copy your Angular app to Cordova = Navigate to the dist folder and copy the contents of the build to the Cordova www folder e.g. angular/dist/getting-started/*.* to cordova/www/*.* (delete anything already in the www folder).

Configure the project = Open www/index.html in a text editor. Change <base href=“/”> to <base href=“./”>

Run the app = From the command line, type

cordova run android

Sometimes the emulator does not start automatically. If this happens manually launch the emulator via Android Studio. The menu item is Tools, AVD Manager.

Sign your app = Before you can publish your app you will need to sign it. You can read more about that here.

Publish your app = To publish your app you will need a Google Play Developer Account. Sign up here.

Plugins

Bluetooth Plugin