mobile

package
v1.0.31-alpha.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package mobile reaches the Android services Gio doesn't expose - the system share sheet and the activity lifecycle - through a small Java helper (mobile_android.java, shipped as mobile_android.jar, which gogio packs into the APK). Elsewhere its functions report ErrUnsupported.

It takes the JVM, Android context and view as plain handles rather than importing gioui.org/app, so it type-checks without the NDK.

Index

Constants

This section is empty.

Variables

View Source
var ErrCanceled = errors.New("canceled")

ErrCanceled is returned when the user dismisses a picker.

View Source
var ErrUnsupported = errors.New("not supported on this platform")

ErrUnsupported is returned on platforms without the service.

Functions

func ClipboardImageURI

func ClipboardImageURI(vm, ctx uintptr) (string, error)

ClipboardImageURI reports ErrUnsupported outside Android.

func Dictate

func Dictate(vm, ctx, view uintptr, lang string) (int, <-chan Speech, error)

Dictate reports ErrUnsupported outside Android.

func FileURI

func FileURI(vm, ctx uintptr, path, mime string) (string, error)

ShareText reports ErrUnsupported outside Android.

func Haptic

func Haptic(vm, ctx, view uintptr, c int) error

Haptic reports ErrUnsupported outside Android.

func KeepAliveDeclared

func KeepAliveDeclared(vm, ctx uintptr) (bool, error)

KeepAliveDeclared reports ErrUnsupported outside Android.

func KeepScreenOn

func KeepScreenOn(vm, ctx, view uintptr, on bool) error

KeepScreenOn reports ErrUnsupported outside Android.

func ListenShares

func ListenShares(vm, ctx uintptr, handler func(Shared)) error

ListenShares reports ErrUnsupported outside Android.

func NotificationsEnabled

func NotificationsEnabled(vm, ctx uintptr) (bool, error)

NotificationsEnabled reports ErrUnsupported outside Android.

func OpenCustomTab

func OpenCustomTab(vm, ctx, view uintptr, url string) error

OpenCustomTab reports ErrUnsupported outside Android.

func OpenDownloads

func OpenDownloads(vm, ctx, view uintptr) error

OpenDownloads reports ErrUnsupported outside Android.

func OpenURL

func OpenURL(vm, ctx, view uintptr, url string) error

OpenURL reports ErrUnsupported outside Android.

func PickDocuments

func PickDocuments(vm, ctx, view uintptr, mimes []string, multiple bool, limit int, media bool) (<-chan Documents, error)

PickDocuments reports ErrUnsupported outside Android.

func PickPhoto

func PickPhoto(vm, ctx, view uintptr, maxSide int, camera bool) (<-chan Photo, error)

PickPhoto reports ErrUnsupported outside Android.

func PickPhotos

func PickPhotos(vm, ctx, view uintptr, maxSide, limit int) (<-chan Photos, error)

PickPhotos reports ErrUnsupported outside Android.

func PlaySound

func PlaySound(vm, ctx uintptr, pcm []byte, rate, channels int) error

PlaySound plays 16-bit PCM samples once (Android only).

func Publish

func Publish(vm, ctx uintptr, path, mime string) (string, error)

Publish reports ErrUnsupported outside Android.

func ReadURI

func ReadURI(vm, ctx uintptr, uri string, max int) ([]byte, error)

ReadURI reports ErrUnsupported outside Android.

func RequestNotifications

func RequestNotifications(vm, ctx, view uintptr) (<-chan bool, error)

RequestNotifications reports ErrUnsupported outside Android.

func SaveToDownloads

func SaveToDownloads(vm, ctx uintptr, path, mime, folder string) (string, error)

SaveToDownloads reports ErrUnsupported outside Android.

func SaveToGallery

func SaveToGallery(vm, ctx uintptr, path, mime, album string) error

SaveToGallery reports ErrUnsupported outside Android.

func SecureDelete

func SecureDelete(vm, ctx uintptr, name string) error

SecureDelete reports ErrUnsupported outside Android.

func SecureGet

func SecureGet(vm, ctx uintptr, name string) ([]byte, bool, error)

SecureGet reports ErrUnsupported outside Android.

func SecureSet

func SecureSet(vm, ctx uintptr, name string, value []byte) error

SecureSet reports ErrUnsupported outside Android.

func SetLifecycleHandlers

func SetLifecycleHandlers(background, foreground func())

SetLifecycleHandlers sets the functions run when the app goes to the background and comes back; nil clears one. They run on the platform's main thread.

func ShareText

func ShareText(vm, ctx, view uintptr, text, subject, title string) error

func ShareURI

func ShareURI(vm, ctx, view uintptr, uri, mime, title string) error

ShareURI reports ErrUnsupported outside Android.

func ShareURIs

func ShareURIs(vm, ctx, view uintptr, uris []string, mime, title string) error

ShareURIs reports ErrUnsupported outside Android.

func StartKeepAlive

func StartKeepAlive(vm, ctx uintptr, reason string) error

StartKeepAlive reports ErrUnsupported outside Android.

func StopDictation

func StopDictation(vm, ctx uintptr, id int) error

StopDictation reports ErrUnsupported outside Android.

func StopKeepAlive

func StopKeepAlive(vm, ctx uintptr) error

StopKeepAlive reports ErrUnsupported outside Android.

func ViewURI

func ViewURI(vm, ctx, view uintptr, uri, mime string) error

func WatchLifecycle

func WatchLifecycle(vm, ctx uintptr) error

WatchLifecycle reports ErrUnsupported outside Android.

Types

type Document

type Document struct {
	FD   int
	Name string
	Size int64
}

Document is a file PickDocuments returned: an open file descriptor the receiver owns, with the file's display name and size (-1 when unknown).

type Documents

type Documents struct {
	Docs []Document
	Err  error
}

Documents is a PickDocuments result: the files, or ErrCanceled when the user picked none, or an error.

type Photo

type Photo struct {
	JPEG []byte
	Name string
	Err  error
}

Photo is the result of PickPhoto: a JPEG, its display name, or an error (ErrCanceled when the user backed out).

type Photos

type Photos struct {
	Photos []Photo
	Err    error
}

Photos is the result of PickPhotos: the picked photos, or an error (ErrCanceled when the user picked none).

type Shared

type Shared struct {
	Text, Subject string
	Files         []SharedFile
}

Shared is what another app shared with this one through the share target.

type SharedFile

type SharedFile struct {
	File       *os.File
	Name, MIME string
	Size       int64 // -1 when unknown
}

SharedFile is one shared file, already open.

type Speech

type Speech struct {
	Text string
	Done bool
	Err  error
}

Speech is one dictation result: partial while Done is false, final when it's true.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL