共用方式為


ActivityManager.SetProcessStateSummary(Byte[]) Method

Definition

Set custom state data for this process.

[Android.Runtime.Register("setProcessStateSummary", "([B)V", "GetSetProcessStateSummary_arrayBHandler", ApiSince=30)]
public virtual void SetProcessStateSummary (byte[]? state);
[<Android.Runtime.Register("setProcessStateSummary", "([B)V", "GetSetProcessStateSummary_arrayBHandler", ApiSince=30)>]
abstract member SetProcessStateSummary : byte[] -> unit
override this.SetProcessStateSummary : byte[] -> unit

Parameters

state
Byte[]

The state data. To be advised, <b>DO NOT</b> include sensitive information/data (PII, SPII, or other sensitive user data) here. Maximum length is 128 bytes.

Attributes

Remarks

Set custom state data for this process. It will be included in the record of ApplicationExitInfo on the death of the current calling process; the new process of the app can retrieve this state data by calling android.app.ApplicationExitInfo#getProcessStateSummary() ApplicationExitInfo.getProcessStateSummary() on the record returned by #getHistoricalProcessExitReasons.

This would be useful for the calling app to save its stateful data: if it's killed later for any reason, the new process of the app can know what the previous process of the app was doing. For instance, you could use this to encode the current level in a game, or a set of features/experiments that were enabled. Later you could analyze under what circumstances the app tends to crash or use too much memory. However, it's not suggested to rely on this to restore the applications previous UI state or so, it's only meant for analyzing application healthy status.

System might decide to throttle the calls to this API; so call this API in a reasonable manner, excessive calls to this API could result a java.lang.RuntimeException.

Java documentation for android.app.ActivityManager.setProcessStateSummary(byte[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to