• Hello
Search Results for

    Show / Hide Table of Contents

    Android - Device Cheating - Detector (Pro)

    Not only can a user modify or manipulate your game or app, but they can also try to gain an advantage by making changes to their device. For example, by installing cheat engine apps that try to manipulate the device's or game's memory and gain advantages.

    Because these types of apps are typically installed on a user's device, their installation cannot be prevented. However, it is possible to identify which apps a user has installed and respond accordingly.

    Detector

    Use the 'AndroidDeviceCheatingDetector' to detect unwanted installed apps. It monitors the 'AndroidInstalledApplicationMonitor' and subscribes to the installed apps found. The detector enables you to perform a comparison with a list of unwanted apps and notifies the observers of the detection. This gives you the opportunity to react to those.

    Observed Subject

    The detector observes the 'IAndroidStatus' interface sent by:

    • AndroidInstalledApplicationMonitor: Determines the installed apps on the device and notifies observers.

    Detector Status

    The detector receives the installed apps by their package name and compares them to your expected values. For example, you can disallow specific apps such as cheating apps on the user's device and react accordingly to ones that are found. The expected values can be assigned in the 'AntiCheat-Settings', described in the next chapters. If unexpected or disallowed apps are detected, the detector notifies its observers with an 'AndroidCheatingDetectionStatus'. The status contains the following properties:

    1. PossibilityOfFalsePositive: A value indicating the possibility of a false positive when assessing threats for the implementing subject, from 0.0 to 1.0.
    2. ThreatRating: The threat rating associated with the detected cheating, indicating the assessed level of a potential threat.
    3. AndroidCheatingType: The type of cheating detected on the Android device.
    4. MonitorFailedToRetrieveData: Whether the monitor notifying the detector failed to retrieve its data, or an exception occurred while retrieving the data over the native interface. In that case, no valid value was returned and no validation could be performed by the detector. Most often, the cause is that parts of the native implementation are not available on the current Android device because an older SDK was used.

    The 'AndroidCheatingType' property can take the following values:

    • DEVICE_INSTALLED_APPS: The device has installed apps that are not allowed.

    Supported Platforms

    The detector is only available on Android platforms.

    Requirements

    Requires an Android build with at least Android 4.4 (API level 19) (December 2013).

    How To Use

    The usage is quite simple: attach an 'AndroidInstalledApplicationMonitor' (if not already done) and the 'AndroidDeviceCheatingDetector' to a child GameObject of the 'AntiCheat-Monitor', enter the unwanted apps in the 'AntiCheat-Project Settings', and define a reaction on detection of those.

    Requirements

    To detect unwanted installed apps, you need to add the 'AndroidInstalledApplicationMonitor' to the same GameObject you will attach the 'AndroidDeviceCheatingDetector' to. The detector will subscribe to the 'AndroidInstalledApplicationStatus', containing the installed app package names, sent by the monitor.

    Add Detector Component

    Manual

    Add the 'AndroidDeviceCheatingDetector' MonoBehavior from the 'GUPS.AntiCheat.Detector.Android' namespace to your 'AntiCheat-Monitor' GameObject, or better, to a child GameObject, next to your 'AndroidInstalledApplicationMonitor' MonoBehavior.

    Add the 'AndroidDeviceCheatingDetector' as a Component.

    Prefab

    There is also a prefab, including the detector and the monitors, which you can directly attach as a GameObject to the 'AntiCheat-Monitor'.

    Add the 'Android Device Cheating Detector' prefab to the 'AntiCheat-Monitor'.

    Settings

    After attaching the 'AndroidDeviceCheatingDetector' MonoBehavior to a GameObject, you will see the following in the inspector:

    The settings of the 'AndroidDeviceCheatingDetector' Component.

    • General Settings: Define here whether the detector should be active.

    • Threat Rating Settings: Define here the severity of the detected cheating.

    • Observable Settings: Add here callbacks invoked when cheating is detected.

    Runtime

    In the Awake callback, the detector observes the 'AndroidInstalledApplicationMonitor' and subscribes to the installed apps found. The detector enables you to perform a comparison with a list of unwanted apps and notifies the observers of the detection. This gives you the opportunity to react to those.

    Define Unwanted Apps

    To define the unwanted apps, you have to enter their package names in the global 'AntiCheat-Project Settings'. To do so, go to 'Project Settings -> GuardingPearSoftware -> AntiCheat'. Go to the section 'Android - Device App - Settings'. Activate the 'Blacklist device apps' checkbox and enter the package names of the apps you want to detect.

    In the AntiCheat Project Settings, assign the package names of the unwanted (blacklisted) apps.

    In the image shown, you can see two examples of package names:

    1. "com.cheating.app": A demo package name to show possible input values.
    2. "catch_.me_.if_.you_.can_": The package name of the general cheating app "GameGuardian".

    So if a user runs your app, the detector will react to any installed app with the entered package names. In the image's case, this would be "com.cheating.app" and "catch_.me_.if_.you_.can_".

    React On Cheating

    When the monitor (data provider) and detector (data validator) are set up, you surely want to react to detected cheating.

    Punisher

    In general, any cheat detected is forwarded to the 'AntiCheat-Monitor', which calculates an overall threat level. Based on the threat level, you can apply punishments by using Punisher components added to a child GameObject of the 'AntiCheat-Monitor'. There are some built-in punishers that you can find here as prefabs:

    The location of the built-in Punisher prefabs.

    Inspector

    You can set a callback in the Unity Inspector view of the detector. This callback is invoked as soon as the specific cheating is detected.

    A list of callbacks invoked when cheating is detected by the detector.

    Code

    If you would like to write a custom listener for the detector, you can attach an observer:

    // Get the detector.
    var detector = AntiCheatMonitor.Instance
          .GetDetector<AndroidDeviceCheatingDetector>();
    
    // Subscribe as observer and get notified on inconsistency.
    detector.Subscribe(myObserver);
    

    The detector also has an inherited property 'PossibleCheatingDetected' which is set to true once cheating has been detected.

    In This Article
    Back to top GuardingPearSoftware documentation