Yes, you can compensate for the effects of hard-iron and soft-iron on an Android device. You would need to determine which one (or both) is skewing the magnetic field around the sensor. Hard-iron offsets are easy to determine and compensate for. Soft-iron skewing of the sphere into an ellipsoid can be much more difficult to deal with. Your implementation will probably depend on what you specifically need to compensate for. The good news is that your sensors are fixed you can probably do the big calculations once and then just apply the offsets.
There are a few different approaches to hard-iron and soft-iron compensation. The most simple approach is this: http://memsense.com/docs/MTD-0802_1.2_Magnetometer_Calibration.pdf. A more difficult approach using least squares fit is described here: http://cache.freescale.com/files/sensors/doc/app_note/AN4248.pdf. The hard iron offset isn't that difficult, but the soft iron offset requires fitting data to an ellipse or ellipsoid and significant amounts linear algebra. I have tried versions of both and they both work. Each has advantages and disadvantages depending on how much processing power you have and how badly the magnetic field is being skewed.