1

My Pixel 5a running Android 13 cannot find a web browser. Looking in this PATH:

patH := "Open PATH " + os.Getenv("PATH")
// Open PATH /product/bin:/apex/com.android.runtime/bin:/apex/com.android.art/bin:/system_ext/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin
url := "http://golang.org"

Using this code for 'open':

cmd := exec.Command("open", url)
// android open open http://golang.org
err = cmd.Start()
// android open err exec: "open": executable file not found in $PATH

Using this code for 'xdg-open':

cmd = exec.Command("xdg-open", url)
// android xdg-open xdg-open http://golang.org
err = cmd.Start()
// android xdg-open err exec: "xdg-open": executable file not found in $PATH

Does anyone know what the Android command is?

I look forward to hearing from you, Dale

Dale E. Moore
  • 431
  • 7
  • 19
  • Android != Linux. On device Android has the concept of [Intents](https://stackoverflow.com/q/6578051/295004) and Android runs it [own framework](https://developer.android.com/guide/components/activities/intro-activities) – Morrison Chang Feb 27 '23 at 04:22
  • Thanks @MorrisonChang! But I'm confused. Are you saying it's impossible to golang program Intents on Android? – Dale E. Moore Mar 02 '23 at 18:29
  • I found this [reddit post](https://www.reddit.com/r/golang/comments/5ne1s5/the_androidgo_project_got_jni_support_can_access/) and [this comment](https://www.reddit.com/r/golang/comments/5ne1s5/comment/dcb3wwy/?utm_source=share&utm_medium=web2x&context=3) which explains the difference between the `go-mobile` and `android-go` project along with the full thread helpful in understanding what you want to do with golang and Android. As Android isolates apps within its own APIs, the JNI reflection example of `android-go` is one way to access Android specific APIs. – Morrison Chang Mar 02 '23 at 23:05

0 Answers0