The System plugin provides comprehensive OS and device information.

Setup

The system plugin is already registered in the default AppTemplate.

API

system.NewPlugin() *SystemPlugin

Creates a new System plugin instance.

(*SystemPlugin).GetInfo() (SystemInfo, error)

Returns OS and device information from the native layer.

Returns: SystemInfo struct or error.

Types

SystemInfo

type SystemInfo struct {
    SystemName          string `json:"system_name"`
    SystemVersion       string `json:"system_version"`
    Model               string `json:"model"`
    SdkInt              int    `json:"sdk_int"`
    Release             string `json:"release"`
    Codename            string `json:"codename"`
    Manufacturer        string `json:"manufacturer"`
    Brand               string `json:"brand"`
    Board               string `json:"board"`
    Device              string `json:"device"`
    Product             string `json:"product"`
    Hardware            string `json:"hardware"`
    BaseOS              string `json:"base_os"`
    SecurityPatch       string `json:"security_patch"`
    Name                string `json:"name"`
    LocalizedModel      string `json:"localized_model"`
    IdentifierForVendor string `json:"identifier_for_vendor"`
    IsPhysicalDevice    bool   `json:"is_physical_device"`
}
Field Platform Description
system_name All "Android" or "iOS"
system_version All Human-readable OS version
model All Device model name
manufacturer Android Build.MANUFACTURER
brand Android Build.BRAND
release Android Build.VERSION.RELEASE
sdk_int Android Build.VERSION.SDK_INT
security_patch Android Security patch level
is_physical_device All Whether the app is running on a real device

Example

import "github.com/sweet-juice/sweetjuice/plugins/system"

plugin := system.NewPlugin()
info, err := plugin.GetInfo()
if err == nil {
    fmt.Printf("Device: %s %s\n", info.Manufacturer, info.Model)
    fmt.Printf("OS: %s %s\n", info.SystemName, info.SystemVersion)
}