created iOS version of Android sample code