Android Automotive FEATURE_AUTOMOTIVE . My application is unable to identify FEATURE_AUTOMOTIVE

498 views
Skip to first unread message

Rohit Iti

unread,
Nov 7, 2020, 7:41:12 AM11/7/20
to Android Automotive OS Discussion Group
This function always returns back with initcar: hasSystemFeature failed. 

if(!getBaseContext().getPackageManager().hasSystemFeature(getBaseContext().getPackageManager().FEATURE_AUTOMOTIVE))
{
Log.d(TAG, "initcar: hasSystemFeature failed");
return;
}

Manifest file changes  :

<uses-feature android:name="android.hardware.type.automotive" android:required="true" />
<uses-permission android:name="android.permission.FEATURE_AUTOMOTIVE" />
<uses-permission android:name="android.hardware.type.automotive" />

Can anyone advise where am going wrong ? 

Frank Bouwens

unread,
Nov 7, 2020, 10:58:18 AM11/7/20
to Android Automotive OS Discussion Group, rohit...@gmail.com
please try this:

if(!getBaseContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) 

{
Log.d(TAG, "initcar: hasSystemFeature failed");
return;
}

With this in manifest:

<uses-permission android:name="android.car.permission.CAR_INFO" />
    <uses-permission android:name="android.car.permission.CAR_ENERGY" />
    <uses-permission android:name="android.car.permission.READ_CAR_DISPLAY_UNITS" />
    <uses-permission android:name="com.google.android.gms.permission.CAR_SPEED" />
    <uses-permission android:name="android.car.permission.CAR_SPEED" />
    <uses-permission android:name="android.car.permission.VMS_PUBLISHER" />
    <uses-permission android:name="android.car.permission.VMS_SUBSCRIBER" />
    <uses-permission android:name="android.car.permission.CAR_DISPLAY_IN_CLUSTER" />
    <uses-permission android:name="android.car.permission.CAR_NAVIGATION_MANAGER" />

This worked for me on Android Automotive emulator.

Op zaterdag 7 november 2020 om 13:41:12 UTC+1 schreef rohit...@gmail.com:

Frank Bouwens

unread,
Nov 7, 2020, 11:00:09 AM11/7/20
to Android Automotive OS Discussion Group, Frank Bouwens, rohit...@gmail.com
And try with android:required="false", instead of true;
Like so:

<uses-feature
android:name="android.hardware.nfc"
android:required="false" />
<uses-feature
android:name="android.hardware.bluetooth"
android:required="false" />
<uses-feature
android:name="android.hardware.location.gps"
android:required="false" />
<uses-feature
android:name="android.hardware.location"
android:required="false" />
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
<uses-feature
android:name="android.hardware.location.network"
android:required="false" />
<uses-feature
android:name="android.hardware.faketouch"
android:required="false" />
<uses-feature
android:name="android.hardware.wifi"
android:required="false" />
<uses-feature
android:name="android.hardware.screen.portrait"
android:required="false" />
<uses-feature
android:name="android.hardware.screen.landscape"
android:required="false" />
<uses-feature
android:name="android.hardware.type.automotive"
android:required="false" />

Op zaterdag 7 november 2020 om 16:58:18 UTC+1 schreef Frank Bouwens:
Reply all
Reply to author
Forward
0 new messages