# GetHistoricalProcessStartReasons(int)

> Returns a list of ApplicationStartInfo records containing the reasons for the most recent app starts.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.Android](/engine/6000.7/script-reference/unityengine/android.md)
* **Assembly:** UnityEngine.AndroidJNIModule

```csharp
public static IApplicationStartInfo[] GetHistoricalProcessStartReasons(int maxNum = 0)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The maximum number of results to be returned. Set this to 0 to ignore this parameter and return all matching records.

### Returns

| Type                                                                                                      | Description                                                                                                                                                                                                        |
| --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [IApplicationStartInfo\[\]](/engine/6000.7/script-reference/unityengine/android/iapplicationstartinfo.md) | An array of [IApplicationStartInfo](/engine/6000.7/script-reference/unityengine/android/iapplicationstartinfo.md) records matching the criteria, sorted in the order from most recent to least recent. Never null. |

### Remarks

For more information, refer to Android's documentation on [getHistoricalProcessStartReasons](https://developer.android.com/reference/android/app/ActivityManager#getHistoricalProcessStartReasons\(int\)). Available on Android API 35+. Returns an empty array on earlier versions.

### Examples

```csharp
using UnityEngine;
using UnityEngine.Android;

public class AppStartDiagnostics : MonoBehaviour
{
    void Start()
    {
        IApplicationStartInfo[] records = ApplicationStartInfoProvider.GetHistoricalProcessStartReasons(1);
        if (records.Length == 0)
        {
            Debug.Log("No start info available (requires Android API 35+).");
            return;
        }

        IApplicationStartInfo info = records[0];

        // Log core start properties.
        Debug.Log($"Process: {info.processName} (pid {info.pid})");
        Debug.Log($"Reason: {info.reason}, type: {info.startType}, state: {info.startupState}");
        Debug.Log($"Force-stopped before launch: {info.wasForceStopped}");

        // Log the launch mode when the start was triggered by an activity launch.
        if (info.reason == StartReason.Launcher || info.reason == StartReason.StartActivity)
            Debug.Log($"Launch mode: {info.launchMode}");

        // Calculate time to first frame; timestamps are clock-monotonic values in nanoseconds.
        if (info.startupTimestamps.TryGetValue(StartTimestamp.Launch, out long launchNs) &&
            info.startupTimestamps.TryGetValue(StartTimestamp.FirstFrame, out long firstFrameNs))
        {
            Debug.Log($"Time to first frame: {(firstFrameNs - launchNs) / 1_000_000} ms");
        }
    }
}
```
