Android Local Quaternions to Unity World

I’m making an application to read quaternions values from my cellphone via bluetooth.
But I stumbled upon a problem trying to use the quaternions from Android in Unity, since they share different axles positions and I want to use 2 or more different initial positions for my cellphone as seen in this image:

test

In first example, the Android X equals Unity Y and so on, but since I’m using quaternions I wanted to know how can I make this conversion to change the axles from Android quaternion to Unity, I’ve searched and found Quaternion.LookRotation but I’m not sure how to use it and if it solves my problem.

You can generate same rotation in unity with some trick.
If you have a quaternion with four components (x,y,z,w), you can directly assign that components with a little modification and create a new unity quaternion. For example, for left android picture, you can use “x” axis as “y” axis in unity. Same for, “y” as “-x” and “z” as “z”. For “w” component, since you are converting a rotation from right hand side coordinate system to left hand side coordinate system (to unity), you must get the negative for “w” component.
So the conversion of (x,y,z,w) components from android to unity is:

Quaternion convertedQuaternion = new Quaternion( -y, x, z, -w); 

Hope that helps.