ionic tutorial - Run Ionic App on Emulator or on your Phone in Ionicframework - ionic framework - ionic 2 - ionic creator - ionic development



Run Ionic App on Emulator or on your Phone in Ionicframework

1. Add a platform target

iOS:

$ ionic platform add ios 
Click below button to copy the code. From wikitechy - ionic tutorial - ionic framework tutorial - team

Android:

$ ionic platform add android
Click below button to copy the code. From wikitechy - ionic tutorial - ionic framework tutorial - team

Windows:

$ ionic platform add windows
Click below button to copy the code. From wikitechy - ionic tutorial - ionic framework tutorial - team

2. Build your app

iOS:

$ ionic build ios 
Click below button to copy the code. From wikitechy - ionic tutorial - ionic framework tutorial - team

Android:

$ ionic build android
Click below button to copy the code. From wikitechy - ionic tutorial - ionic framework tutorial - team

Windows: Windows:

$ ionic build windows
Click below button to copy the code. From wikitechy - ionic tutorial - ionic framework tutorial - team

Live Reload App During Development (beta)

The run or emulate command will deploy the app to the specified platform devices/emulators. You can also run live reload on the specified platform device by adding the --livereload option. The live reload functionality is similar to ionic serve, but instead of developing and debugging an app using a standard browser, the compiled hybrid app itself is watching for any changes to its files and reloading the app when needed. This reduces the requirement to constantly rebuild the app for small changes. However, any changes to plugins will still require a full rebuild. For live reload to work, the dev machine and device must be on the same local network, and the device must support web sockets. With live reload enabled, an app’s console logs can also be printed to the terminal/command prompt by including the --consolelogs or -c option. Additionally, the development server’s request logs can be printed out using --serverlogs or -s options.

Command-line flags/options for run and emulate

[--livereload|-l] .......  Live Reload app dev files from the device (beta)
[--consolelogs|-c] ......  Print app console logs to Ionic CLI (live reload req.)
[--serverlogs|-s] .......  Print dev server logs to Ionic CLI (live reload req.)
[--port|-p] .............  Dev server HTTP port (8100 default, live reload req.)
[--livereload-port|-i] ..  Live Reload port (35729 default, live reload req.)
[--debug|--release]
Click below button to copy the code. From wikitechy - ionic tutorial - ionic framework tutorial - team

While the server is running for live reload, you can use the following commands within the CLI:

restart or r to restart the client app from the root
goto or g and a url to have the app navigate to the given url
consolelogs or c to enable/disable console log output
serverlogs or s to enable/disable server log output
quit or q to shutdown the server and exit
Click below button to copy the code. From wikitechy - ionic tutorial - ionic framework tutorial - team

3. Emulating your app

Deploys the Ionic app on specified platform emulator. This is simply an alias for run --emulator.

iOS:

$ ionic emulate ios [options]
Click below button to copy the code. From wikitechy - ionic tutorial - ionic framework tutorial - team

Android:

$ ionic emulate android [options]
Click below button to copy the code. From wikitechy - ionic tutorial - ionic framework tutorial - team

Windows:

$ ionic emulate windows [options]
Click below button to copy the code. From wikitechy - ionic tutorial - ionic framework tutorial - team

During emulating app in AVD or mobiles, you can inspect that app in chrome browser. Type following command in address bar of the chrome browser.

$ ionic emulate windows [options]
Click below button to copy the code. From wikitechy - ionic tutorial - ionic framework tutorial - team

4. Running your app

Deploys the Ionic app on specified platform devices. If a device is not found it'll then deploy to an emulator/simulator.

iOS:

$ ionic run ios [options]
Click below button to copy the code. From wikitechy - ionic tutorial - ionic framework tutorial - team

Android:

$ ionic run android [options]
Click below button to copy the code. From wikitechy - ionic tutorial - ionic framework tutorial - team

Windows:

$ ionic run windows [options]
Click below button to copy the code. From wikitechy - ionic tutorial - ionic framework tutorial - team

4.1. Specifying your target

$ ionic run [ios/android/windows] --target="[target-name]"
Click below button to copy the code. From wikitechy - ionic tutorial - ionic framework tutorial - team

You can check the target name of your device/emulator running $ adb devices.


Related Searches to Run Ionic App on Emulator or on your Phone in Ionicframework