# Previewing apps in the browser

> Test your iOS or Android app in the browser with App Preview



App Preview is our iOS simulator and Android emulator running in your browser. Launch and interact with your iOS or Android app right in the browser, regardless of the operating system you are using. Test your app against different device and OS configurations, emulate GPS location or demo the latest app version without needing access to a physical device. 

{{< youtube l1VeZXtO0zQ >}}

**Tip:** The following sections describe creating previewable artifacts using codemagic.yaml. If you're using the Flutter Workflow Editor, follow the instructions [here](../flutter-distributing/app-preview).

## Enabling App Preview and Free Trial



> 
> This feature is available for **teams** only. 
> 



Teams on the **Pay as you go** plan can enable the feature via the **App Preview** page on the left sidebar and will get 100 free trial minutes. Once used up, further app preview minutes will be billed at the rate of $0.095/min and included in your monthly invoice.

Teams on annual plans can try out App Preview by [contacting us](https://codemagic.io/contact/).

## Creating iOS .app binaries for previewing on the simulator

To create a `.app` to run on the iOS simulator, consult the **codemagic.yaml** samples below.





### Option: iOS



Sample **codemagic.yaml** for building an iOS `.app` binary using Xcode build commands.


```yaml

workflows:
  simulator-workflow:
    name: Build for simulator
    environment:
      xcode: latest
    scripts:
      - name: Build with Generic Destination
        script: |
          xcodebuild build \
            -project "yourproject.xcodeproj" \
            -scheme "yourscheme" \
            -sdk iphonesimulator \
            -configuration Debug
    artifacts:
      - /Users/builder/Library/Developer/Xcode/DerivedData/**/*.app

```






### Option: Flutter



Sample **codemagic.yaml** for building an iOS `.app` binary for Flutter projects.


```yaml

workflows:
  flutter-ios-simulator:
    name: Flutter iOS Simulator
    environment:
      flutter: 3.27.3
      xcode: 16.2
    scripts:
      - flutter build ios --simulator --flavor staging  # --flavor is optional
    artifacts:
      - build/ios/iphonesimulator/Runner.app

```





On a successful build, you will see the **Quick Launch** button next to the `.app` artifact in build overview.

## Creating Android .apk binaries for previewing on the emulator

You can preview any `.apk` artifact built in Codemagic. 

In your codemagic.yaml, ensure that the `artifacts` section contains the path to the `.apk` artifact so that it is picked up and displayed among the build artifacts in Codemagic, as in the following example.


```yaml

workflows:
  android:
    name: Android debug workflow
    scripts:
      - name: Set Android SDK location
        script: |
          echo "sdk.dir=$ANDROID_SDK_ROOT" > "$CM_BUILD_DIR/local.properties"
      - name: Build Android
        script: |
          ./gradlew assembleDebug
    artifacts:
      - app/build/outputs/apk/debug/app-debug.apk

```


On a successful build, you will see the **Quick Launch** button next to the `.apk` artifact in build overview.


## Previewing apps 

Clicking **Quick Launch** next to a suitable artifact launches an iOS simulator or an Android emulator respectively with your app installed on it, right in your browser. 

To use a different device and OS combination, click the three dots on the controls menu and select **Change device**.

The preview session remains active for a maximum of **20 minutes** and is limited to one concurrent session by default. To end the ongoing session, select **Stop session** from the menu.
