目录

GameCallback

Interface Info

public interface GameCallBack

Internal API defined in the GameManager class. This API can be used to send device information such as the temperature, CPU load, and GPU load.

Public Method Summary

Qualifier and Type

Method Name and Description

void

onPhoneInfoUpdated

Obtains device information such as the temperature.

Public Methods

[h2]onPhoneInfoUpdated

Method

public void onPhoneInfoUpdated(String info)

Obtains device information such as the temperature, CPU load, and GPU load. The device information obtained using this method is in the same format as that obtained using the getPhoneInfo method of GameManager.

Parameters

Name

Description

String info

Key resource information returned by the device, including the current temperature level, CPU load, and GPU load.

Example in the JSON format:

{
    "MessageType": "20001",
    "TempCurLevel": "1",
    "TempTrendValue": "50",
    "TempTrendMargin": "10",
    "CpuPerfInfos": [{
            "CpuLoad": "9"
        }
    ],
    "GpuPerfInfos": [{
            "GpuLoadLevel": "1",
            "VertexLoadLevel": "1",
            "FragmentLoadLevel": "10",
            "TextureLoadLevel": "10",
            "BandwidthLoadLevel": "1",
            "GpuFreqCurr": "1"
        }
    ]
}
  • MessageType(int): This parameter is mandatory. The value 20001 indicates the key resource message returned by the system.
  • TempCurLevel(byte): This parameter is mandatory. It indicates the current temperature level.
    • 1: normal.
    • 2: warm. You are advised to lower the specifications for services that are not perceivable to users, such as slowing down background updates or deferring execution.
    • 3: heating up. You are advised to suspend services that are not perceivable to users and lower the specifications for the game's non-core services, such as slowing down foreground updates.
    • 4: hot. The system's resource supply decreases. You are advised to lower the game's overall specifications, such as the resolution, graphics quality, and frame rate.
    • 5: overheating. The system's resource supply largely decreases. You are advised to further lower the game specifications.
  • TempTrendValue (int): normalized value of the temperature trend, ranging from -100 to 100. A positive value indicates that the temperature is increasing, while a negative value indicates that the temperature is decreasing. The absolute value indicates the rate of change. This parameter is optional.
    • A negative value indicates a decrease in temperature.
    • 0 indicates no change in temperature.
    • A positive value indicates an increase in temperature.
  • TempTrendValue(int): time margin for temperature trend, that is, the time required to reach a specific temperature level, in seconds. The value is a natural number. This parameter is optional.
  • CpuPerfInfos(list): information about the current CPU load, in the form of a singleton set. This parameter is mandatory.
    • CpuLoad(int): CPU load, ranging from 0 to 100. A larger value indicates a heavier load.
  • GpuPerfInfos(list): information about the current GPU load, in the form of a singleton set. This parameter is optional.
    • GpuLoadLevel(int): overall GPU load level, ranging from 1 to 10. A larger value indicates a heavier load.
    • VertexLoadLevel(int): vertex processing load level, ranging from 1 to 10. A larger value indicates a heavier load.
    • FragmentLoadLevel(int): fragment processing load level, ranging from 1 to 10. A larger value indicates a heavier load.
    • TextureLoadLevel(int): texture processing load level, ranging from 1 to 10. A larger value indicates a heavier load.
    • BandwidthLoadLevel(int): bandwidth load level, ranging from 1 to 10. A larger value indicates a heavier load.
    • GpuFreqCurr(int): current operating frequency of the GPU, in kHz.

The value may be null or empty.

The possible causes are as follows:

  • The game has not called the registration API, or the API call has failed.
  • The system has not reported device information. In this case, restart the device to resolve the issue.