Mobile - Genuine - Detector
Malicious or unauthorized distribution of applications, especially on mobile devices, often involves changing the package name for republishing. Use the 'MobileGenuineDetector' to implement a genuine validation of mobile apps.
Detector
The 'MobileGenuineDetector' (class MobileGenuineDetector, namespace GUPS.AntiCheat.Detector.Mobile) checks whether the built mobile app is genuine, using Unity's Application.genuine API. It does not require any monitor. On Android, it should be combined with the AntiCheat solutions specifically developed for Android apps, as the general genuine check does not detect all possible manipulations.
Observed subject
The detector does not observe any monitor. It queries Application.genuine directly.
Status
The detector notifies its observers with a CheatingDetectionStatus, which implements IDetectorStatus:
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(inspector field, recommended 500). High, because false positives are very unlikely and the impact of a repackaged app is significant.
Lifecycle and timing
- In
Start, ifCheckGenuineOnlyOnGameStartis enabled, it runs a single genuine check (ManualGenuineCheck()). - The periodic recheck loop only runs on platforms where
Application.genuineCheckAvailableis true, and only re-checks whenCheckGenuineOnlyOnGameStartis disabled, usingRecheckIntervalForPossibleCheating(realtime seconds). - You can also trigger
ManualGenuineCheck()yourself; it returns false when tampering is detected.
Configuration
- Is Active (
isActive, bool, default true) - whether the detector is active and watching. - Threat Rating (
threatRating, uint, default 500) - the threat rating reported on each detection. - On Cheating Detection Event (
OnCheatingDetectionEvent) - a UnityEvent raised on every detection; wire up reactions in the inspector without writing an observer. - Check Genuine Only On Game Start (
CheckGenuineOnlyOnGameStart, bool, default true) - run the genuine check only once on start. The genuine check can be resource intensive; disable to check on an interval. Recommended: true. - Recheck Interval For Possible Cheating (
RecheckIntervalForPossibleCheating, float, default 60, range 0.001-600) - interval in seconds between genuine checks when start-only checking is disabled.
Supported platforms
The detector is available on Android and iOS. On other platforms it is unsupported and self-disables.
Requirements
There are no requirements. No additional monitor is required. The periodic recheck only runs where Application.genuineCheckAvailable is true.
How To Use
Attach a 'MobileGenuineDetector' to a child GameObject of the 'AntiCheat-Monitor' and define a reaction to detected cheating.
Add Detector Component
Manual
Add the 'MobileGenuineDetector' MonoBehavior from the 'GUPS.AntiCheat.Detector.Mobile' namespace to your 'AntiCheat-Monitor' GameObject, or better, to a child GameObject.

Add the 'MobileGenuineDetector' as a Component.
Prefab
There is also a prefab, including the detector, which you can directly attach as a GameObject to the 'AntiCheat-Monitor'.

Add the 'Mobile Genuine Detector' prefab to the 'AntiCheat-Monitor'.
Settings
After attaching the 'MobileGenuineDetector' MonoBehavior to a GameObject, you will see the following in the inspector:

The settings of the 'MobileGenuineDetector' 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.
- Genuine Settings: Set here whether the genuine check should be done once, or repeated every x seconds.
Runtime
The genuine check runs once on the Start callback and, when start-only checking is disabled, repeats on the configured interval. If the genuine check fails, the detector notifies observers of the detected cheating.
Consume the detection in code
Besides the inspector event, you can subscribe your own observer. Every detector derives from ADetector and exposes Subscribe(IObserver<IDetectorStatus>), which returns an IDisposable you can dispose to unsubscribe. Get the detector via the AntiCheat-Monitor:
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 On Cheating
When the detector (data validator) is 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<MobileGenuineDetector>();
// 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.