Code Monkey home page Code Monkey logo

unity-sdk-device-utils's Introduction

Device Utils for Unity

Requirements

  • Unity 5.3+
  • iOS 8.0+
  • Android API level 16+

Table of Contents

Integration

Import the SDK package funplus-unity-sdk-device-utils-<version>.unitypackage to your project.

The FunPlus SDK is structured in this way:

Assets/
└── FunPlus/
    └── DeviceUtils/
        ├── Editor/
        ├── Example/
        └── Plugins/
            ├── Android/
            └── iOS/

The Example directory is not necessarily a part of the SDK. You can choose not to import it to your project.

For Android Project Only

FunPlus SDK uses the Google Advertising ID to uniquely identify devices. To allow the SDK to use the Google Advertising ID, you must integrate the Google Play Services.

Usage

To call methods provided by DeviceUtils, the first step is to import its namespace to your source files:

using FunPlus.DeviceUtils;

Get Play Advertising ID (Android Only)

This method might return null.

string playAdId = DeviceUtils.GetPlayAdId ();

Get Android ID (Android Only)

string androidId = DeviceUtils.GetAndroidId ();

Get Identifier for Vendor (iOS Only)

This method might return null.

string idfv = DeviceUtils.GetIdentifierForVendor ();

Get Advertising Identifier (iOS Only)

This method might return null.

string idfa = DeviceUtils.GetAdvertisingIdentifier ();

Get System Name

string systemName = DeviceUtils.GetSystemName ();

Get System Version

string systemVersion = DeviceUtils.GetSystemVersion ();

Get Device Model Name

string modelName = DeviceUtils.GetModelName ();

Get Device Manufacturer (Android Only)

string manufacturer = DeviceUtils.GetManufacturer ();

Get Android API Level (Android Only)

string androidApiLevel = DeviceUtils.GetAndroidApiLevel ();

Get App Name

string appName = DeviceUtils.GetAppName ();

Get App Version

string appVersion = DeviceUtils.GetAppVersion ();

Get App Display Language

This method gets the display language for the application, it might be different from the device language.

string appLanguage = DeviceUtils.GetAppLanguage ();

Get Network Carrier Name

string carrier = DeviceUtils.GetNetworkCarrierName ();

Get Screen Brightness

This method returns an integer ranged from 0 to 255 inclusively.

int brightness = DeviceUtils.GetScreenBrightness ();

Set Screen Brightness

For Android project, add the following permission declaration before the application tag in your AndroidManifest.xml if they're not present already.

<uses-permission android:name="android.permission.WRITE_SETTINGS"/>

Note that on Android 6.0+, it will return false and lead the user to a window that requests the WRITE_SETTINGS permission for the first time this method is called.

Value of the brightness parameter should be between 0 and 255. values less than 0 will be treat as 0, and values greater than 255 will be treat as 255.

int brightness = 120;
bool isSuccess = DeviceUtils.SetScreenBrightness (brightness);

unity-sdk-device-utils's People

Contributors

yuankunzhang avatar

Watchers

 avatar

Forkers

eriseven yumu908

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.