Skip to content

Using the Android Emulator

Vladimir edited this page Apr 5, 2024 · 7 revisions

Connecting to your host machine

To connect to the CoopCycle server running on your machine, use the special address 10.0.2.2

Also note that the address 127.0.0.1 on your development machine corresponds to the emulator's own loopback interface. If you want to access services running on your development machine loopback interface (a.k.a. 127.0.0.1 on your machine), you should use the special address 10.0.2.2 instead.

Set Up Android Emulator Networking

Simulating location

When the emulator is running, in Android Studio go to Tools > Android > Android Device Monitor.

In the Emulator Controls tab, you can set the location manually, or load GPX file to simulate location changes.

Testing remote push notifications

You can test remote push notifications on the Android emulator.

1. Create an AVD with Google APIs

When creating an AVD, at the step Select a system image, choose x86 Images, and make sure to choose an image where the Target column says Android XXX (Google APIs)

The app has been successfully tested with Oreo - API Level 26 - Android 8.0

2. Setup Firebase

  1. Setup a Firebase account to download google-services.json
  2. Copy google-services.json to the android/app folder

To test it on a local CoopCycle instance running in Docker, you will also need to configure FCM