doc.go raw

   1  // SPDX-License-Identifier: Unlicense OR MIT
   2  
   3  /*
   4  Package permission includes sub-packages that should be imported
   5  by a Gio program or by one of its dependencies to indicate that specific
   6  operating-system permissions are required. For example, if a Gio
   7  program requires access to a device's Bluetooth interface, it
   8  should import "github.com/p9c/p9/pkg/gel/gio/app/permission/bluetooth" as follows:
   9  
  10  	package main
  11  
  12  	import (
  13  		"github.com/p9c/p9/pkg/gel/gio/app"
  14  		_ "github.com/p9c/p9/pkg/gel/gio/app/permission/bluetooth"
  15  	)
  16  
  17  	func main() {
  18  		...
  19  	}
  20  
  21  Since there are no exported identifiers in the app/permission/bluetooth
  22  package, the import uses the anonymous identifier (_) as the imported
  23  package name.
  24  
  25  As a special case, the gogio tool detects when a program directly or
  26  indirectly depends on the "net" package from the Go standard library as an
  27  indication that the program requires network access permissions. If a program
  28  requires network permissions but does not directly or indirectly import
  29  "net", it will be necessary to add the following code somewhere in the
  30  program's source code:
  31  
  32  	import (
  33  		...
  34  		_ "net"
  35  	)
  36  
  37  Android -- Dangerous Permissions
  38  
  39  Certain permissions on Android are marked with a protection level of
  40  "dangerous". This means that, in addition to including the relevant
  41  Gio permission packages, your app will need to prompt the user
  42  specifically to request access. To access the Android Activity
  43  required for prompting, use app.ViewEvent (only available on Android).
  44  app.ViewEvent exposes the underlying Android View, on which the
  45  getContext method returns the Activity.
  46  
  47  For more information on dangerous permissions, see:
  48  https://developer.android.com/guide/topics/permissions/overview#dangerous_permissions
  49  */
  50  package permission
  51