• Hello
Search Results for

    Show / Hide Table of Contents

    Mobile - Genuine - Detector

    Some copies of a mobile game are changed and published again under a different package name. The package name is the id of your app, such as com.company.game. This detector checks that the running app is still yours.

    This detector is part of the Free and the Pro version.

    Walkthrough: Protecting an Android build and Protecting an iOS build.

    What it does

    MobileGenuineDetector (namespace GUPS.AntiCheat.Detector.Mobile) asks Unity if the app is genuine. It uses Unity's Application.genuine for that. It has no monitor.

    This check does not catch every kind of edit. On Android, also use the app tampering detector (Pro).

    Do you need to add it?

    No, if you use the predefined Anti-Cheat-Monitor prefab. It already includes this detector.

    If you use your own monitor prefab, drag the Mobile Genuine Detector prefab onto the monitor so it becomes a child.

    The detector prefabs in Assets/GUPS/AntiCheat/Resources/Prefabs/Detectors.

    Settings

    The MobileGenuineDetector settings.

    • Is Active (isActive, bool, default true): Turns the detector on or off.
    • Threat Rating (threatRating, default 500): How much the find adds to the threat score. It is high because a false alarm is very unlikely and a republished app matters a lot.
    • On Cheating Detection Event (OnCheatingDetectionEvent): Methods to call when the app is not genuine.
    • Check Genuine Only On Game Start (CheckGenuineOnlyOnGameStart, bool, default true): Check once when the game starts. The check can be heavy, so on is recommended. Turn it off to repeat the check.
    • Recheck Interval For Possible Cheating (RecheckIntervalForPossibleCheating, seconds, 0.001 to 600, default 60): The wait between two checks when the option above is off.

    The chance of a false alarm is fixed at 0.01. You cannot change it.

    What it reports

    When the app is not genuine, the detector sends a CheatingDetectionStatus:

    public struct CheatingDetectionStatus : ICheatingDetectionStatus
    {
        // The kind of cheat. Here: ECheatType.Genuine.
        public ECheatType CheatType { get; }
    
        // How likely this find is a false alarm, from 0 to 1.
        public float PossibilityOfFalsePositive { get; }
    
        // How much this find adds to the threat score.
        public uint ThreatRating { get; }
    }
    

    You can also run the check yourself:

    var detector = AntiCheatMonitor.Instance.GetDetector<MobileGenuineDetector>();
    
    if (detector != null && !detector.ManualGenuineCheck())
    {
        // The app is not genuine.
    }
    

    Good to know

    • The flag stays. PossibleCheatingDetected stays true after the first find.
    • Reported once. A changed app stays changed. A repeated check does not raise the score again.
    • Unity decides. If Unity cannot run the check on a device, the detector reports nothing there.

    Platforms and requirements

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

    There are no requirements, and no monitor is needed.

    React to a find

    The find is added to the threat score of the Anti-Cheat Monitor. The predefined monitor prefab has no punisher. So nothing more happens to the player until you react yourself or add a punisher.

    In the Inspector. Add a method to On Cheating Detection Event. It runs when the app is not genuine.

    Inspector callbacks on a detector.

    In code. Ask the detector:

    var detector = AntiCheatMonitor.Instance.GetDetector<MobileGenuineDetector>();
    
    if (detector != null && detector.PossibleCheatingDetected)
    {
        // The app is not genuine.
    }
    

    Or listen, so your code runs at the moment of the find. 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}");
        }
    
        public void OnError(Exception error) { }
        public void OnCompleted() { }
    }
    

    Back to the Detector overview.

    In This Article
    Back to top GuardingPearSoftware documentation