Utility code compatible with Android.