How Can I View Ionic App in Mobile?

Irene Olsen

Are you wondering how to view your Ionic app on a mobile device? It can be a little tricky, but with the proper tools and knowledge, you’ll be able to test your app on your phone in no time.

Step 1: Install Ionic CLI
To start, make sure you have the Ionic CLI installed on your computer. If you don’t have it yet, open up your terminal or command prompt and run the following command:

  • npm install -g @ionic/cli

This will install the latest version of the Ionic CLI globally on your machine.

Step 2: Create a new project
Next, create a new project if you haven’t already done so. To do this, navigate to the directory where you want to create your project and run:

  • ionic start myApp tabs --type=angular --capacitor

This will create a new Ionic app with tabs layout.

Step 3: Add Capacitor
Capacitor is required to run an Ionic app natively on your mobile device. To add Capacitor to your project, navigate into the project directory and run:

  • cd myApp
  • npx cap init myApp com.example.myappname --web-dir=www --npm-client=npm

This will initialize Capacitor in your project and create native projects for iOS and Android platforms.

Step 4: Build Your App for Production.
Before running your app on mobile devices, build it for production using the following command:

  • ionic build --prod

Once built successfully, navigate to the root directory of your project and run:

  • npx cap copy

This command will copy your app’s web assets to the native projects.

Step 5: Run Your App on Mobile Device
To run your app on a mobile device, first, connect your device to your computer using a USB cable. Then, in the terminal, navigate to the root directory of your project and run:

  • npx cap open ios

This will open Xcode with your iOS project. From Xcode, select your connected device and click the “Run” button.

For Android, run the following command:

  • npx cap open android

This will open Android Studio with your Android project. From there, select your connected device and click “Run”.


In conclusion, viewing an Ionic app on a mobile device requires a few steps but can be accomplished quickly if you follow these instructions. By installing necessary tools like Ionic CLI and Capacitor and building for production before running on mobile devices, you’ll be able to test and debug efficiently. Happy coding!