How to record motion data of smartphone and use it in Blender?

It’s possible to connect phone to pc and use it’s sensors for different tasks (I used it for games where needs controller with gyro). But how to record it and then use it in Blender?

If you can stream the data via python you can access the stream directly within blender
Check for a python API to stream your phone data