github.com/gop9/olt@v0.0.0-20200202132135-d956aad50b08/gio/app/permission/doc.go (about)

     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/gop9/olt/gio/app/permission/bluetooth" as follows:
     9  
    10  	package main
    11  
    12  	import (
    13  		"github.com/gop9/olt/gio/app"
    14  		_ "github.com/gop9/olt/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 Gio
    41  permission packages, your app will need to prompt the user specifically
    42  to request access. This can be done with a java Fragment, installed using
    43  (*app.Window).RegisterFragment(). For more information on dangerous
    44  permissions, see: https://developer.android.com/guide/topics/permissions/overview#dangerous_permissions
    45  */
    46  package permission