• Hello
Search Results for

    Show / Hide Table of Contents

    Android - Installed Apps - Monitor (Pro)

    A cheat app can sit next to your game and change its memory. You cannot stop the player from installing it. You can notice that it is there.

    Walkthrough: Cheat apps on Android.

    Monitor

    AndroidInstalledApplicationMonitor (namespace GUPS.AntiCheat.Monitor.Android) reads the apps on the device. System apps are ignored. It then sends an AndroidInstalledApplicationStatus with the blocked package names it found.

    Status

    The monitor sends an AndroidInstalledApplicationStatus:

    public struct AndroidInstalledApplicationStatus : IAndroidStatus
    {
        // True if the list could not be retrieved (e.g. a JNI failure).
        public bool FailedToRetrieveData { get; }
    
        // The blacklisted package names currently installed on the device.
        public List<string> Applications { get; }
    }
    
    • FailedToRetrieveData: The app list could not be read. The list is not valid.
    • Applications: Blocked package names that are installed. Only names from your list are returned, not every app on the phone.

    Lifecycle and timing

    The monitor reads the apps once, when it starts. It then sends one AndroidInstalledApplicationStatus. If the read fails, it still sends a status, with FailedToRetrieveData set to true.

    Configuration

    This monitor has no Inspector fields. The blocked package names are set in Project Settings. The detector uses that list. Open Edit > Project Settings > GuardingPearSoftware > AntiCheat and go to Android - Device - Settings.

    Blocked device apps.

    Development builds

    Verify development builds is off by default. While it is off, the check skips development builds and the Editor. Turn it on while you test.

    Turn on Verify development builds to also check development builds and the Editor.

    Supported platforms

    Android only.

    Requirements

    Android 4.4 (API level 19) or newer.

    How to use

    Add AndroidInstalledApplicationMonitor as a child of the AntiCheat-Monitor. Pair it with AndroidDeviceCheatingDetector.

    Add the component

    Add AndroidInstalledApplicationMonitor from GUPS.AntiCheat.Monitor.Android. A child of the monitor is the best place.

    Add the AndroidInstalledApplicationMonitor component.

    Read the status in code

    You can also listen yourself. Subscribe returns an IDisposable. Dispose it when you want to stop.

    using System;
    using GUPS.AntiCheat.Core.Watch;
    using GUPS.AntiCheat.Monitor.Android;
    using UnityEngine;
    
    public class AndroidInstalledAppsStatusLogger : MonoBehaviour, IObserver<IWatchedSubject>
    {
        private void Start()
        {
            var monitor = GetComponentInChildren<AndroidInstalledApplicationMonitor>();
            monitor.Subscribe(this);
        }
    
        public void OnNext(IWatchedSubject subject)
        {
            if (subject is AndroidInstalledApplicationStatus status)
            {
                if (status.FailedToRetrieveData)
                {
                    Debug.LogWarning("Could not read the installed apps.");
                    return;
                }
    
                Debug.Log($"Found {status.Applications.Count} blacklisted apps.");
            }
        }
    
        public void OnError(Exception error) { }
        public void OnCompleted() { }
    }
    

    Detect a blocked app

    To treat a found app as cheating, use the Android device cheating detector.

    In This Article
    Back to top GuardingPearSoftware documentation