- Unity 5.3+
- iOS 8.0+
- Android API level 16+
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.
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.
To call methods provided by DeviceUtils
, the first step is to import its namespace to your source files:
using FunPlus.DeviceUtils;
This method might return null
.
string playAdId = DeviceUtils.GetPlayAdId ();
string androidId = DeviceUtils.GetAndroidId ();
This method might return null
.
string idfv = DeviceUtils.GetIdentifierForVendor ();
This method might return null
.
string idfa = DeviceUtils.GetAdvertisingIdentifier ();
string systemName = DeviceUtils.GetSystemName ();
string systemVersion = DeviceUtils.GetSystemVersion ();
string modelName = DeviceUtils.GetModelName ();
string manufacturer = DeviceUtils.GetManufacturer ();
string androidApiLevel = DeviceUtils.GetAndroidApiLevel ();
string appName = DeviceUtils.GetAppName ();
string appVersion = DeviceUtils.GetAppVersion ();
This method gets the display language for the application, it might be different from the device language.
string appLanguage = DeviceUtils.GetAppLanguage ();
string carrier = DeviceUtils.GetNetworkCarrierName ();
This method returns an integer ranged from 0 to 255 inclusively.
int brightness = DeviceUtils.GetScreenBrightness ();
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);