Running on mobiles

For Android, iOS, tvOS the gogio tool can build and package a Gio program for you.


To build an Android .apk file from the gophers example:

$ go run -target android

The apk can be installed to a running emulator or attached device with adb:

$ adb install gophers.apk

The gogio tool passes command line arguments to os.Args at runtime:

$ go run -target android -token <github token>

iOS, tvOS

The -appid flag specifies the iOS bundle id or Android package id. The flag is required for creating signed .ipa files for iOS and tvOS devices, because the bundle id must match an id previously provisioned in Xcode. For example,

$ go run -target ios -appid <bundle-id>

Use the Window->Devices and Simulators option in Xcode to install the ipa file to the device. If you have ideviceinstaller installed, you can install the app from the command line:

$ ideviceinstaller -i gophers.ipa

If you just want to run a program on the iOS simulator, use the -o flag to specify a .app directory:

$ go run -o -target ios

Install the app to a running simulator with simctl:

$ xcrun simctl install booted

App Icon

The gogio tool will use the appicon.png file in your main package directory, if present, as the app icon.