How to create a simple pedometer-like app ?

Is it possible to create pedometer-like app using UE4 ?

For simplicity purposes just counting steps and printing out step counter.

How would one go about such functionality using Blueprints only ?

Thanks

Blueprints only?No. Both battery wise and possibility wise. You’d have to write some C++ to communicate with java (on a custom engine version I guess) that you are also going to write, via JNI. With java you’ll be given access to the phones sensors and GPS, thus being able to calculate steps etc - but that part is up to you. You have to account for battery life with background services, because you can’t have the whole engine running if you just want to count steps.

For me, it’d be:
Difficulty: Hard
Time needed: A lot, especially if you are not experienced with C++/JNI/Java before
Worth it? Maybe for learning/fun purposes. Starting to do such thing to a project in production would drag eevrything behind :stuck_out_tongue:

I actually wonder if it’s possible (and probably easier) to count steps if a person is walking in place.

Unreal Engine (or any 3D engine) is absolutely the wrong tool for doing that, because you’ll run down the battery for the user.

Typically, a pedometer looks for cyclic patterns in the built-in accelerometer (or, if present, gyro,) and derive step counts from that. They may also use GPS to get an estimate of distance traveled, depending on application.
There’s a simple GUI that displays what you’ve done and lets you configure the app – no need for an advanced content pipeline at all.

The easiest way to build that kind of app would be with the native development tools (Android Studio or XCode.)
On Android this is actually easier, because Android lets you run a background Service that doesn’t get killed; on iOS you have to do all kinds of tricks (geofencing, etc) to get woken up when the user moves.
(Actually, iOS 8+ now has an API that gives you step counts on the right version of iOS and devices, so you can just use that instead; similarly Android has had that since 4.4!)

If you need cross-development, try perhaps Xamarin (“mono for phones.”)
Or, use some plugin to Apache Cordova to let you write the UI as a web page, and use the plugin to read the accelerometer. However, this is again less efficient, because it can’t run in the background very well.

@jwatte: it’s not really a pedometer app for Android :slight_smile: I need this for locomotion in my mobile VR experience. Just for simplicity I asked using pedometer example, since essentially I’d use 1 step as so many units to move player forward.

The problem with the pedometer API is that it responds very slowly.
For VR, it’s way too slow; it will lead to significant motion sickness.
You can open the accelerometer and analyze it to extract real-time motion information, though.

I’m working on a similar app, and I’m wondering if something like Google Fit would work better? (just syncing up every few seconds when the game is running). Although it doesn’t seem that Fit is one of the services that UE4 has blueprints for yet.

Does anyone know of any tutorials that could show how I might integrate an android google service that isn’t already covered in the UE4 Google Play Services (login, achievements, leaderboard, and IAPs) ?