Removing gravity from accelerometer data?

Hello, I am currently working on making a vr module for Android and iOS devices using viewport frames, gyroscope, and accelerometer data. I was wondering if any of you knew some neat tricks to remove the gravity from the accelerometer data so I can attempt to make it so the user can move their head and controllers/hands