Skip to content

GameFrameX/com.gameframex.unity.systeminfo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Game Frame X Logo

BlankDeviceUniqueIdentifier

License Version Unity Version Documentation

All-in-One Solution for Indie Game Development · Empowering Indie Developers' Dreams


Documentation · Quick Start · QQ Group: 467608841 / 233840761


English | 简体中文 | 繁體中文 | 日本語 | 한국어

Features

API Description Return Value
DeviceGetOaid Get device OAID (Android only) Raw OAID (stripped -, max 32 chars)
DeviceGetIdfa Get device IDFA (iOS only) Raw IDFA (stripped -, max 32 chars)
DeviceGetImei Get device IMEI Raw IMEI (stripped -, max 32 chars)
DeviceUniqueIdentifier Get device unique machine ID MD5 hash (32-char hex string)

All APIs cache results via PlayerPrefs. System interfaces are not called again after the first retrieval.

Quick Start

Installation

Choose one of the following methods:

  1. Edit your Unity project's Packages/manifest.json and add the scopedRegistries section:

    {
      "scopedRegistries": [
        {
          "name": "GameFrameX",
          "url": "https://gameframex.upm.alianblank.uk",
          "scopes": [
            "com.gameframex"
          ]
        }
      ],
      "dependencies": {
        "com.gameframex.unity.systeminfo": "3.0.1"
      }
    }

    scopes controls which packages are resolved through this registry. Only packages whose names start with com.gameframex will be fetched from it.

  2. Add to manifest.json dependencies:

    {
       "com.gameframex.unity.systeminfo": "https://github.com/gameframex/com.gameframex.unity.systeminfo.git"
    }
  3. Use Package Manager in Unity with Git URL: https://github.com/gameframex/com.gameframex.unity.systeminfo.git

  4. Clone the repository into your Unity project's Packages directory. It will be loaded automatically.

Quick Start

Installation

Choose one of the following methods:

  1. Edit your Unity project's Packages/manifest.json and add the scopedRegistries section:

    {
      "scopedRegistries": [
        {
          "name": "GameFrameX",
          "url": "https://gameframex.upm.alianblank.uk",
          "scopes": [
            "com.gameframex"
          ]
        }
      ],
      "dependencies": {
        "com.gameframex.unity.systeminfo": "3.0.1"
      }
    }

    scopes controls which packages are resolved through this registry. Only packages whose names start with com.gameframex will be fetched from it.

  2. Add to manifest.json dependencies:

    {
       "com.gameframex.unity.systeminfo": "https://github.com/gameframex/com.gameframex.unity.systeminfo.git"
    }
  3. Use Package Manager in Unity with Git URL: https://github.com/gameframex/com.gameframex.unity.systeminfo.git

  4. Clone the repository into your Unity project's Packages directory. It will be loaded automatically.

Platform Implementation

Platform DeviceGetOaid DeviceGetIdfa DeviceGetImei DeviceUniqueIdentifier
Android JNI reflection (MSA / Huawei / Xiaomi / OPPO / vivo / Samsung) SystemInfo.deviceUniqueIdentifier (fallback) JNI call to TelephonyManager MD5 of IMEI + hardware info + Android ID + WLAN MAC + BT MAC
iOS SystemInfo.deviceUniqueIdentifier (fallback) ASIdentifierManager.advertisingIdentifier native __DeviceGetIMEI() (IDFV) native DeviceUniqueId() (SSKeychain)
Editor / Other SystemInfo.deviceUniqueIdentifier SystemInfo.deviceUniqueIdentifier SystemInfo.deviceUniqueIdentifier SystemInfo.deviceUniqueIdentifier

Permissions (Optional)

This plugin does not require any permissions. It gracefully degrades without them. The plugin does not ship with an AndroidManifest.xml. The following permissions should be declared in the consuming project's AndroidManifest.xml as needed.

Android

Permission Improves DeviceUniqueIdentifier uniqueness Improves DeviceGetImei uniqueness
READ_PHONE_STATE IMEI included in hash Can retrieve real IMEI
ACCESS_WIFI_STATE WLAN MAC included in hash -
BLUETOOTH Bluetooth MAC included in hash -
<!-- Add to the consuming project's AndroidManifest.xml as needed -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH" />

iOS

Config Purpose
NSUserTrackingUsageDescription ATT authorization description required for IDFA
<!-- Add to the consuming project's Info.plist -->
<key>NSUserTrackingUsageDescription</key>
<string>Your advertising identifier will be used to provide better services</string>

Usage Examples

using GameFrameX.SystemInfo.Runtime;

// Get device OAID (Android only, falls back to SystemInfo.deviceUniqueIdentifier on iOS/Editor)
string oaid = BlankDeviceUniqueIdentifier.DeviceGetOaid;

// Get device IDFA (iOS only, falls back to SystemInfo.deviceUniqueIdentifier on Android/Editor)
string idfa = BlankDeviceUniqueIdentifier.DeviceGetIdfa;

// Get device IMEI
string imei = BlankDeviceUniqueIdentifier.DeviceGetImei;

// Get device unique identifier
string deviceId = BlankDeviceUniqueIdentifier.DeviceUniqueIdentifier;

iOS IDFA Notes

IDFA requires user authorization via ATT (App Tracking Transparency). Add to Info.plist before use:

<key>NSUserTrackingUsageDescription</key>
<string>Your advertising identifier will be used to provide better services</string>

And request authorization before calling DeviceGetIdfa:

#if UNITY_IOS || UNITY_IPHONE
// iOS 14+ requires ATT authorization first
if (UnityEngine.iOS.Device.systemVersion.CompareTo("14") >= 0)
{
    UnityEngine.iOS.Device.RequestUserAuthorization(UnityEngine.iOS.UserTracking.Authorization);
}
#endif
string idfa = BlankDeviceUniqueIdentifier.DeviceGetIdfa;

When unauthorized, DeviceGetIdfa returns an empty string without crashing.

Directory Structure

Plugins/
  iOS/
    BlankDeviceUniqueIdentifier/
      AHDeviceUniqueIdentifier.h               # iOS native header
      AHDeviceUniqueIdentifier.mm              # iOS native implementation
      SSKeychain.h                              # SSKeychain keychain utility
      SSKeychain.m
Runtime/
  BlankDeviceUniqueIdentifier.cs               # C# unified interface (Android uses JNI to call system APIs directly, no Java/JAR needed)

On Android, AndroidJavaClass / AndroidJavaObject is used to call system APIs and vendor SDKs directly — no Java code compilation or JAR files required.

Dependencies

Package Description
(无) -

Documentation & Resources

Community & Support

  • QQ Group: 467608841 / 233840761

Changelog

See Releases for changelog.

License

See LICENSE.md for license information.