MotionEmulator

English Version | 中文文档

Motion Emulator is an application platform that allows you to mock location and sensor data using different methods, including Xposed and debugging options.

Scenarios

Trick your fitness app or your favourite game. Make you king of the world.

Usage

To learn about the latest software and its tricks, refer to Steve's Blog.

Build Instructions

Build and maintain this project with the latest Android Studio Canary (currently Hedgehog | 2023.1.1 Canary 15) because this project is pretty radical.

This app contains sdk from Amap and Google Maps, thus api keys are required. Obtain them from here and here

echo amap.web.key="<Your Key>" >> local.properties
echo AMAP_SDK_KEY="<Your Key>" >> local.properties
echo GCP_MAPS_KEY="<Your Key>" >> local.properties

My own service is involved to provide online features like self update, which is optional and shouldn't be included in unofficial builds.

However, it is still possible to build with your own service.

cd app
echo SERVER_URI="<Your Server>" >> server.properties
echo PRODUCT="<You Decide>" >> server.properties

cd ../mock_location_plugin
echo SERVER_URI="<Your Server>" >> server.properties
echo PRODUCT="<You Decide>" >> server.properties

The SERVER_URI is supposed to be an HTTP/HTTPS RESTful that implements a certain protocol. You can get an example by looking at my codebase.

By the way, in case you are not familiar with Android dev, fill in your own SDK like so:

echo sdk.dir=<Your SDK Full Path> >> local.properties

License

Copyright 2022-2023 zhufucdev

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Special Thanks

Package

com.zhufucdev.motion_emulator

Authors

Steve Reed

Releases

v1.2.2

Release type: Stable

8/7/2023, 10:06:56 AM

You can get a translated text here

Bugfix

  • Crash when exporting (sharing) recorded data
  • Visual bugs in Recording and Emulation UI
  • Missing navigate up tooltip in Compose-based pages

v1.2.1

Release type: Stable

8/5/2023, 7:07:04 AM

Bugfix

  • Failure dragging newly downloaded plugins

Note for LSPosed Repository users

From this release on, no plug-in will be included, as you can download them directly from the app.

v1.2.0

Release type: Stable

8/1/2023, 4:35:18 PM

You can get translated and more detailed text here

Plug-in System

The newly introduced plug-in system makes Motion Emulator more powerful than ever.

  • The main app itself is decoupled from Xposed.
  • To implement full functionality, install Xposed-based plug-ins.
  • You can get a list of available plug-ins in the Plug-in UI.
  • Download, install and manage within clicks and gestures.

The power of plug-ins appears to be

  • Flexibility: plug-ins can be optimized for certain apps, providing the best experience;
  • Compatibility: host to module communication layer is separated from Motion Emulator, as a result of which special apps can be forged into the system;
  • Management: specify different hooking methods per app;
  • Advancement: different modules can be upgraded in parallel, fixing bugs and making improvement with ease.

WebSocket-based Protocol

  • Implementation of realtime communication between host app and module.
  • ProtoBuf is used for improved efficiency.

Better Emulation

  • Severe bugs of v1.1.7, the last release, have been fixed.
  • Because of the above changes, the Websocket Plugin carries the latest improvements.

v1.1.7

Release type: Stable

5/7/2023, 6:54:29 AM

Better hook

  • AMap anti-proguard, thanks to #40
  • Better GNSS support for Android 10 and below devices
  • Support speed faking, based on time and location

Migrate to HTTP-based protocol

  • Settings UI for port and TLS tuning
  • Better compatibility with host apps (API >= 30)

ME Location Mock Plugin

  • Support for non-root devices
  • This is implemented in form of a separate app
  • Settings UI for basic tuning
  • From this version on, this app will be included in the binary files

Bugfix

  • Crashes when undo is pressed during satellites sampling
  • Wrong title for shared data export

v1.1.6

Release type: Stable

4/9/2023, 1:30:35 AM

Parallel Emulations Support

  • Emulation runs on multiple apps simultaneously
  • Swipe card to iterate through the intermediate states

Bugfix

  • When using GPS sampling, logic of undo was weird
  • Alert dialog would pop up even if traces had been saved

v1.1.5

Release type: Stable

4/5/2023, 12:36:30 AM

User-friendliness

  • Dialog alerting unsaved trace changes
  • Dialog notifying GPS unavailability

Bugfix

  • Color scheme and size of location indicator works like charm now

v1.1.4

Release type: Stable

4/4/2023, 12:50:44 PM

GPS Sampling

  • Use GPS to draw trace
  • In DrawTrace UI, the default location indicator is for preview only, which doesn't suggest exact location
  • For users in China mainland:
请勿使用Google Maps进行GPS采样,会有坐标偏移

Bugfix

  • #12 #19 #21: Crash problem by bad GPS provider opting
  • Traces box happen to be empty, due to bad timing sequence

1.1.3

Release type: Stable

3/2/2023, 1:52:33 PM

Pending Screen for Maps

  • At first use of maps, a screen will pop up to ask for choosing the provider

Bugfix

  • When choose AMap as provider, traces in emulation configuration screen will no longer be empty
  • Dialogs in settings page now adopts Material You theme

v1.1.2

Release type: Stable

3/2/2023, 12:59:35 AM

Trace Editor

  • Modify coordinate system label within a trace

Bugfix

  • GnssStatusCallback will now be skipped if satellite count is set to zero or less, making it work for some apps (maybe

1.1.1

Release type: Stable

3/1/2023, 2:22:05 PM

Google Maps Integration

  • Can use Google Maps in trace drawing and emulation configuration activity
  • Google Places API (aka POI search) is now an option
  • The Google Maps is now the default option, and you can select AMap in the settings page

Settings Page

  • To change map and POI engine provider
  • To customize time format

Bugfix

  • Status bar now follows the color of top app bar
  • A large app bar is enabled for home screen
  • App bar in data manager screen is nested

Note: from this release on, split apks are provided to reduce download size

1.1.0

Release type: Stable

1/16/2023, 3:12:53 PM

Data Backup

  • Export, import and share your records
  • Select which records you want

Bugfix

  • Border floated over the controllers in random factor UI
  • Captions not capitalized

1.0.9

Release type: Stable

1/5/2023, 1:58:27 AM

Manage & Adding Salt

To make each run different, I'd like to introduce salt to you

  • Basic salt includes scale, rotate, translate and anchor. Use custom matrix for more freedom
  • Each field of a salt is a math expression, so that very flexible the system is, and randomized variables can be involved
  • Specify the probability distribution of each variable using Bézier curve

Moreover, each data is nameable, so it won't mess up

Bugfix

  • A bad Chinese translation was changed
  • In trace drawing page, no need to double click the save button

1.0.8

Release type: Stable

12/20/2022, 6:40:18 AM

I don't quite remember. Here's what is still in my brain

Data Manager (beta)

  • Listing all data (trace, motion, cells), displaying their info
  • Delete with a simple swipe gesture

Data Structure Change

Warning: you may suffer data loss, cause the way the app stores data changed.

If you'd like to keep your record, run the following script as root:

#!/bin/sh
cd /data/data/com.zhufucdev.motion_emulator

mkdir files

for motion in $(ls app_motion)
do
mv app_motion/$motion files/motion_$motion
done

for record in $(ls app_record)
do
mv app_record/$record files/record_$record
done

for cell in $(ls app_cells)
do
mv app_cells/$cell files/cells_$cell
done

Jetpack Compose

To make the app more reactive (programmatically), home and manager page are written in Compose.

Plans are made to migrate more pages.

1.0.7

Release type: Stable

12/3/2022, 10:51:35 AM

Blocking & Bypassing

  • Sensor and cell data now supports bypassing and blocking
  • When blocked, the target app won't receive incoming changes
  • When bypassed, the target app will use native sensor data

Notification Support

  • When put into background, the app will send a notification that indicates the status of simulation

Bugfix

  • Motion sensor simulation now works perfectly

1.0.6

Release type: Stable

11/29/2022, 6:45:41 AM

Map Offset Fix

  • Emulated location now matches the drawn trace

Bugfix

  • Trace drawing no longer offsets from fingertip

From this release on, MotionEmulator enters stable

1.0.5 Beta

Release type: Stable

11/28/2022, 1:22:43 PM

Material You

Migrated to Material You, the app taking a brand-new look. If you don't know

  • App color scheme matches system style on Android S and later
  • Redesigned card, button, app bar and switch controls

Bugfix

IDK how it worked, but some bug related to emulation was fixed

Art

The new logo is a great piece of art, since I am a great artist

  • Added some good-looking icon
  • Supported themed icon

1.0.4 Beta

Release type: Stable

11/24/2022, 2:45:54 AM

Improved User Experience

  • Map camera animation was implemented
  • Debug log won't be printed
  • Able to set default configuration for emulation

Bug fix

  • Specific sensors won't cause crash while recording
  • Not recording cell info won't smash the app

v1.0.3 Beta

Release type: Stable

11/20/2022, 5:47:50 AM

Introducing MotionEmulator Beta

Implemented

  • Material Design 2 UI
  • Motion sensor recorder
  • Cell station recorder
  • Trace drawer
  • Emulation preview
  • And other functions as you may have expected

Not implemented

  • Map offset fixing
  • Trace map camera

From this release on, the development stage comes to beta

What to expect

Bug and bug. Feel free to issue a PR