• Hello
Search Results for

    Show / Hide Table of Contents

    Mobile - Genuine - Detector

    Some copies of a mobile game are republished under a different package name. MobileGenuineDetector checks that the running app is still yours.

    Detector

    MobileGenuineDetector (namespace GUPS.AntiCheat.Detector.Mobile) uses Unity's Application.genuine. It does not need a monitor. On Android, also use the Android package checks. This genuine check does not catch every kind of edit.

    Observed subject

    The detector does not watch a monitor. It reads Application.genuine itself.

    Status

    The detector sends a CheatingDetectionStatus:

    public struct CheatingDetectionStatus : IDetectorStatus
    {
        // Probability that the detection is a false positive, in the range [0.0, 1.0].
        public float PossibilityOfFalsePositive { get; }
    
        // The threat rating reported with this detection.
        public uint ThreatRating { get; }
    }
    

    Threat rating and false positives

    • PossibilityOfFalsePositive: 0.01 (fixed).
    • ThreatRating: default 500 (recommended 500). False alarms are rare, and a republished app matters a lot.

    Lifecycle and timing

    • In Start, if Check Genuine Only On Game Start is on, it checks once (ManualGenuineCheck()).
    • A repeat check only runs where Application.genuineCheckAvailable is true. It only repeats when the start-only option is off. The wait is RecheckIntervalForPossibleCheating, in real seconds.
    • You can call ManualGenuineCheck() yourself. It returns false when the app is not genuine.

    Configuration

    • Is Active (isActive, bool, default true): Turns the detector on or off.
    • Threat Rating (threatRating, uint, default 500): How much one find adds to the threat score.
    • On Cheating Detection Event (OnCheatingDetectionEvent): Functions to call when the app is not genuine.
    • Check Genuine Only On Game Start (CheckGenuineOnlyOnGameStart, bool, default true): Check once at start. The check can be heavy. Turn this off to repeat it. Recommended: on.
    • Recheck Interval For Possible Cheating (RecheckIntervalForPossibleCheating, float, default 60, range 0.001 to 600): Seconds between checks when the start-only option is off.

    Supported platforms

    Android and iOS. On other platforms the detector turns itself off.

    Requirements

    None. No monitor is needed. Repeat checks only run where Application.genuineCheckAvailable is true.

    How to use

    Add MobileGenuineDetector as a child of the AntiCheat-Monitor. Then choose how you want to react.

    Add the component

    Manual

    Add MobileGenuineDetector from GUPS.AntiCheat.Detector.Mobile. A child of the monitor is the best place.

    Add the MobileGenuineDetector component.

    Prefab

    You can also drop in the prefab.

    Add the Mobile Genuine Detector prefab to the AntiCheat-Monitor.

    Settings

    The MobileGenuineDetector settings.

    • General Settings: Turn the detector on or off.
    • Threat Rating Settings: How serious one find is.
    • Observable Settings: Functions to call when cheating is found.
    • Genuine Settings: Check once, or again every few seconds.

    Runtime

    The check runs once in Start. If the start-only option is off, it repeats on the interval. If the check fails, the detector tells its listeners.

    Read the detection in code

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

    using System;
    using GUPS.AntiCheat;
    using GUPS.AntiCheat.Core.Detector;
    using GUPS.AntiCheat.Detector.Mobile;
    using UnityEngine;
    
    public class MobileGenuineDetectionLogger : MonoBehaviour, IObserver<IDetectorStatus>
    {
        private void Start()
        {
            var detector = AntiCheatMonitor.Instance.GetDetector<MobileGenuineDetector>();
            detector.Subscribe(this);
        }
    
        public void OnNext(IDetectorStatus status)
        {
            Debug.LogWarning($"App is not genuine (threat={status.ThreatRating}, fp={status.PossibilityOfFalsePositive}).");
        }
    
        public void OnError(Exception error) { }
        public void OnCompleted() { }
    }
    

    React when a cheat is found

    The detector tells the AntiCheat-Monitor. The monitor adds the report to the threat score.

    Punisher. Add a punisher prefab as a child of the monitor. It runs when the score reaches its limit.

    Built-in punisher prefabs.

    Inspector. Add a function to On Cheating Detection Event. It runs when this detector finds a cheat.

    Inspector callbacks on a detector.

    Code.

    var detector = AntiCheatMonitor.Instance
          .GetDetector<MobileGenuineDetector>();
    
    detector.Subscribe(myObserver);
    

    PossibleCheatingDetected stays true after the first find.

    In This Article
    Back to top GuardingPearSoftware documentation