I wrote a code based on following paper in c++ on UE4 and installed it on a android smartphone;
An efficient orientation filter for inertial and inertial magnetic sen