2 API differences between iOS and Android

These are just 2 differences that I’ve encountered recently, and I’m sure there’ll be more to come. Points to note when doing cross-platform coding.

Signed-ness of char type

char type is signed in iOS, but unsigned in Android NDK. For the latter, I’ve just discovered this post, which suggests that its an ARM code generation behaviour for gcc that can be handled by passing LOCAL_CFLAGS := -fsigned-char. I will give this a try.

Accelerometer reading values

iOS returns accelerometer readings in units of g, while Android returns in ms^-2. So for a device lying screen up on the table, iOS reports z = -1, while Android reports z = -9.81

Android also has a constant defined for the gravitational constant of Death Star.

No Comments.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre lang="" line="" escaped="" cssfile="">