Authing DocsDocuments
Concept
workflow
Guides
Development Integration
Application integration
Concept
workflow
Guides
Development Integration
Application integration
Old Version
Development Integration
  • Single Sign-On (SSO)
  • Login component

  • JavaScript/Node.js

  • Java / Kotlin

  • Python

  • C#

  • PHP

  • Go

  • Ruby
  • Android

    • Quick start
    • Hosting page
    • APIs

    • Third-party identity source

    • Scenario

      • Logout
      • Overseas
      • Authing OTP
      • Device management
    • On-premise
    • Android Guard Change log
    • Error code
  • iOS

  • Flutter

  • React Native
  • WeChat Mini Program
  • WeChat webpage authorization
  • Framework Integration
  • Error code
  1. Development Integration
  2. /
  3. Android
  4. /
  5. Scenario
  6. /
  7. Device management

¶ Device management

Update Time: 2025-05-14 08:32:28
Edit

First make sure it's done quick start。

This feature was added in android guard sdk 1.5.7 version.


Device management is performed by the DeviceManager class, which encapsulates the device management API for ease of use.

¶ Reporting device

Need to report to device before account login.

Call createDevice method to quickly report the device, example:

DeviceManager.getInstance().createDevice(this, new AuthCallback<JSONObject>() {
  @Override
  public void call(int code, String message, JSONObject data) {
      if (code == 10002){
          // Please select and use Authing.init(context, "AUTHING_APP_ID");
      } else if (code == 10029){
          // Please select to apply for READ_PHONE_STATE permission,sdk < 29 need
      } else if (code == 200){
          // success
      }
  }
});

You can also report it automatically in the following ways, for example:

DeviceInfo deviceInfo = new DeviceInfo();
deviceInfo.setDeviceUniqueId("");
deviceInfo.setName("");
deviceInfo.setVersion("Android 13");
deviceInfo.setHks("");
deviceInfo.setFde("");
deviceInfo.setHor("");
deviceInfo.setType("Mobile");
deviceInfo.setProducer("");
deviceInfo.setMod("");
deviceInfo.setOs("Android");
deviceInfo.setSn("");
deviceInfo.setImei("");
deviceInfo.setMeid("");
deviceInfo.setDescription("");
DeviceManager.getInstance().createDevice(deviceInfo, (AuthCallback<JSONObject>) (code, message, data) -> {
    if (code == 200 && data != null) {
        // success
    }
});

¶ Get device information

Call the deviceList method to get device information, example:

DeviceManager.getInstance().deviceList(1, 50, null, "Android", "", 
                (AuthCallback<ArrayList<DeviceData>>) (code, message, deviceList) -> {
    if (code == 200) {
        // success
    }
});

¶ Off-line device

Call the logoutByDeviceId method to go offline, example:

DeviceManager.getInstance().logoutByDeviceId(deviceId, (AuthCallback<JSONObject>) (code, message, data) -> {
    if (code == 200) {
        // success
    }
});

¶ Remove device

Call the removeDevice method remove device information,example:

DeviceManager.getInstance().removeDevice(deviceId, (AuthCallback<JSONObject>) (code, message, data) -> {
    if (code == 200) {
        // success
    }
});

¶ Subscribe device event

Call the subDeviceEvent method to subscribe to a device event, for example:

DeviceManager.getInstance().subDeviceEvent(new IDeviceReceiver() {
            @Override
            public void onOpen() {
								// Connection successful
            }

            @Override
            public void onReceiverEvent(DeviceEvent deviceEvent) {
                // Receive event message
              	int logoutType = deviceEvent.getLogoutType();
                if (logoutType == DeviceManager.LOGOUT_ANOTHER) {
       							//User side: Personal Center - Log out
                } else if (logoutType == DeviceManager.PROFILE_UNBIND) {
         						//User side: Personal Center - Unbind the device
                } else if (logoutType == DeviceManager.SUSPEND_DEVICE_BY_USER) {
     								//Administrator: User list - Personal Details - Suspend the device
                } else if (logoutType == DeviceManager.SUSPEND_DEVICE) {
     								//Administrator: Manage devices - Suspend devices
                } else if (logoutType == DeviceManager.DISABLE_DEVICE_BY_USER ) {
										//Administrator: User list - Personal Details - Disable devices
                } else if (logoutType == DeviceManager.DISABLE_DEVICE) {
										//Administrator: Manage devices - Disable devices
                } else if (logoutType == DeviceManager.DELETE_DEVICE_BY_USER) {
										//Administrator: User List - Personal Details - Remove Device (Unbind)
                } else if (logoutType == DeviceManager.DELETE_DEVICE) {
										//Administrator: Manage devices - Delete devices
                }
            }

            @Override
            public void onError(String s) {
									// Connection failure
            }
        });

¶ Shutdown device event

Call the closeDeviceEvent method to close the device subscription event for a single account, example:

DeviceManager.getInstance().closeDeviceEvent(token);

¶ Disable all device events

Call the closeAllDeviceEvent method to close the device subscription event for all accounts as shown in the following example:

DeviceManager.getInstance().closeAllDeviceEvent();
Prev: Authing OTP Next: On-premise
  • Reporting device
  • Get device information
  • Off-line device
  • Remove device
  • Subscribe device event
  • Shutdown device event
  • Disable all device events

User identity management

Integrated third-party login
Mobile phone number flash check (opens new window)
Universal login form component
Custom authentication process

Enterprise internal management

Single Sign On
Multi-factor Authentication
Authority Management

Developers

Development Document
Framework Integration
Blog (opens new window)
GitHub (opens new window)
Community User Center (opens new window)

Company

400 888 2106
sales@authing.cn
16 / F, Block B, NORTH STAR CENTURY CENTER, Beijing(Total)
room 406, 4th floor, zone B, building 1, No. 200, Tianfu Fifth Street, Chengdu(branch)

Beijing ICP No.19051205-1

© Beijing Steamory Technology Co.