Android Auto Detection

Detection of Android Auto connection is a feature available only on Android devices. It provides useful fine-tuning information for possible screen sharing detection observer notifications. A new connection to Android Auto typically causes multiple virtual displays to be added (and some to be removed immediately). This triggers screen sharing detection with transient changes.

Android Auto connection is reported as part of the screen sharing detection. It’s present in both - the screen sharing callback data of the MalwarelyticsRaspListener and in the manually obtained screen sharing detection data. Changes to Android Auto connection also trigger the screen sharing callback of the MalwarelyticsRaspListener.

The Android Auto detection data can also be independently queried by triggering a manual check.

Manual Check

You can manually check for Android Auto connection using the getAndroidAutoDetection() method:

if (Platform.OS === 'android') {
    const androidAuto = await Malwarelytics.sharedInstance.rasp.getAndroidAutoDetection();

    console.log(`Is Android Auto connected = ${androidAuto.isAndroidAutoConnected}`);
    
    if (androidAuto.isAndroidAutoConnected) {
        console.log(`Android Auto info: ${JSON.stringify(androidAuto)}`);
    }
}

AndroidAutoDetectionInfo

The getAndroidAutoDetection() method returns an AndroidAutoDetectionInfo object with the following properties:

Property Type Description
isAndroidAutoConnected boolean Indicates whether Android Auto is connected.
connection AndroidAutoConnectionInfo Contains the type of Android Auto connection.

AndroidAutoConnectionInfo

The AndroidAutoConnectionInfo is an enum with the following possible values:

| Value | Description | |————————|————————————————————————————| | NOT_CONNECTED | Indicates that the device is not connected to any car head unit. | | CONNECTED_NATIVE | Indicates that the app is natively running on a head unit (Android Automotive OS). | | CONNECTED_PROJECTION | Indicates that the device is connected to a car head unit by projecting to it. | ```

Last updated on Jul 04, 2025 (08:51) View product
Search

develop

Malwarelytics for React Native