# Android GetInputMotionState node not working

**URL:** <https://forums.unrealengine.com/t/android-getinputmotionstate-node-not-working/606372>\
**Category:** Platform & Builds\
**Tags:** unreal-engine, Android\
**Created:** [July 16, 2022, 3:37pm UTC](https://forums.unrealengine.com/t/android-getinputmotionstate-node-not-working/606372 "2022-07-16T15:37:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PieBaron](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PieBaron](https://forums.unrealengine.com/u/PieBaron)\
**Post date:** [July 16, 2022, 3:37pm UTC](https://forums.unrealengine.com/t/android-getinputmotionstate-node-not-working/606372/1 "2022-07-16T15:37:50Z")

</div>

ello, I am trying to get GetInputMotionState node to work in blueprint, I saw online someone say this:

```auto
"Fixed by using the node 'Get Input Motion State' instead of 'Get Tilt'. Make sure when adding it you uncheck 'Context Sensitive' as there's a 'Player Controller' input on the node." 

```

Im sure I’m using the right node, but it only returns 0,0,0  
I have “allow IMU sampling” enabled in my project settings.  
Get location under finger is working, but the Get Input Motion State stays at 0,0,0

 ![tilt not working](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/7/3/1730d17e045211729c2d62d3a100fb57db1cb01b.jpeg)

---

<div class="post-metadata">

**Author:** ![PieBaron](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PieBaron](https://forums.unrealengine.com/u/PieBaron)\
**Post date:** [July 16, 2022, 4:56pm UTC](https://forums.unrealengine.com/t/android-getinputmotionstate-node-not-working/606372/2 "2022-07-16T16:56:32Z")

</div>

the best clue I found so far is that if the phone doesnt have a magnetometer, these inputs will not work ( my phone does not have a magnetometer )

> [@Input Motion State is always 0](https://forums.unrealengine.com/t/input-motion-state-is-always-0/435560/4):
>
> Hi. The Android device must have a magnetometer. If magnetometer is not present in the device, the input motion values are not calculated. This is happening in the lastest versions of the engine. To know if your device has a magnetometer, install a compass app on it. If there is not a magnetometer, the app will fail. If you need to get input motion values in devices without a magnetometer, the GameActivity.java template must be modificated. Take a look to this issue: [Unreal Engine Issues and …](https://issues.unrealengine.com/issue/UE-59537)

Apparently the “GameActivity.java template must be modificated” to make it work, but I dont know how…

I really wish this information was made more clear, I’ve lost 2 evenings trying to figure out this issue.  
We should be allowed to access the sensor data regardless, even if it is folly, if a developer decides to block a functionality we should be made clearly aware.

---

<div class="post-metadata">

**Author:** ![PieBaron](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PieBaron](https://forums.unrealengine.com/u/PieBaron)\
**Post date:** [July 16, 2022, 5:17pm UTC](https://forums.unrealengine.com/t/android-getinputmotionstate-node-not-working/606372/3 "2022-07-16T17:17:33Z")

</div>

I was able to get input working by modifiying the GameActivity.java file to change the code to not depend on magnetometer references, either by commenting out sections asking for it and / or replacing parts. I kept the original default magnetometer declaration and set it to {0,0,1}  
I am sure this could be done better, since my results are very jittery, im hoping some smoothing will help.  
So if anyone has had this issue before, please share your solution / workaround. I am sharing my modified GameActivity.java file here (make a backup, my mod is hacky)

[GameActivity.java.template](https://forums.unrealengine.com/uploads/short-url/cWcxOSdPocQ9q4cqETM6AWhoMAx.template) (202.8 KB)

the path is  
UE\_5.0\Engine\Build\Android\Java\src\com\epicgames\unreal

---

<div class="post-metadata">

**Author:** ![JerginBergin1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JerginBergin1](https://forums.unrealengine.com/u/JerginBergin1)\
**Post date:** [March 26, 2024, 4:37am UTC](https://forums.unrealengine.com/t/android-getinputmotionstate-node-not-working/606372/4 "2024-03-26T04:37:32Z")

</div>

YOU SAVED ME !!!
