If you want to learn, how to deploy the developed Ionic 2 application on your Android device without publishing to the Play Store, then you are in the right tutorial.
You can preview and test your Ionic 2 application using
1. Browser (ionic serve --lab)
2. Ionic View App(ionic upload)
3. Emulators(Genymotion for Android and Xcode for iOS)
4. Physical Device(Android and iPhone)
Please note: You can not directly install and test your app on iPhone. But you can directly install and test your app on Android. iPhone doesn't allow apps which are not published on the App Store.
In this tutorial, you will learn, how to deploy the developed Ionic 2 Android app on the Android Mobile Phone. I am not going to write more theory about this process. Let see how to do this in simple steps.
The below software example and codes are tested with the MacOS Sierra and Moto G4 Plus(Android Phone).
Install Android Studio
You can use the below link to learn, to setup the Android on MacOS Sierra.
Set Android platform to the terminal using the below code.
Replace the YourLocation with your actual Android installed location.
If you don't know the location of the installed Android, open the Android Studio and click the SDK Manager.
From the below image you can able to find the installed Android Location.
Everything is ready in the System/laptop. Now you need to ready your Android device.
Enable Developer option on your Android device.
Go to settings and click the About Phone.
Click the Build Number five times continuously to enable the developer option on your Android device.
Now click the Developer options on the settings page.
Enable the USB debugging option
Now connect your Android phone to the Mac OS through USB cable.
To list the available Android device use the below command in the terminal.
The above command will display the connected device information.
That's all. All done. Now you are ready to deploy and test the developed Ionic 2 mobile application on your Android device.
Now go to your Ionic 2 project root directory on the terminal.
Add the Android platform using the below command.
ionic platform add android
Deploy the app using the below command.
ionic run android
Now the Ionic 2 app is deployed on your Android device. Enjoy testing the application on your Android phone.
Every Ionic 2 developer wants to test their application on the physical device. This tutorial focuses the Android deployment only. Why because iPhone does not allow this kind of deployment. To test the iOS applications on the iPhone, you must sign-in and upload the developed application to the App Store(https://developer.apple.com).
To know more about the iOS test flight(Beta Testing), use the below link.