Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can only get 4 properties? #12

Open
nikagersonlohman opened this issue Apr 27, 2021 · 16 comments
Open

Can only get 4 properties? #12

nikagersonlohman opened this issue Apr 27, 2021 · 16 comments

Comments

@nikagersonlohman
Copy link

nikagersonlohman commented Apr 27, 2021

Any thoughts why I can only get 4 properties?

CarPropertyConfig{mPropertyId= 287310850 > PARKING_BRAKE_ON
CarPropertyConfig{mPropertyId= 289408000 > GEAR_SELECTION
CarPropertyConfig{mPropertyId= 289408001 > CURRENT_GEAR
CarPropertyConfig{mPropertyId= 289408009 > IGNITION_STATE

When I list all properties, I only see the above 4:

        // Create a list of properties in debug window
        val carPropertyList = carPropertyManager.propertyList
        Log.d(TAG, "carPropertyList: " + carPropertyList.toString())
        for (i in 0 until carPropertyList.size) {
            val carProperty = carPropertyList[i]
            data.add(carProperty.toString())
        }

If I try to register any other property, I get an error:
E/CarPropertyManager: registerListener: propId is not in config list: 291504647

Here's the code I try to use:

        // Subscribes to the car speed events.
        carPropertyManager.registerCallback(
            carPropertyCarSpeedListener,
            VehiclePropertyIds.PERF_VEHICLE_SPEED,
            CarPropertyManager.SENSOR_RATE_ONCHANGE
        )

I did add CAR_SPEED permission to my manifest:

    <uses-permission android:name="android.car.permission.CAR_SPEED" />
@frankkienl
Copy link

Maybe some other permissions are needed as well 🤔

@nikagersonlohman
Copy link
Author

Yeah... but which... who knows... where to ask?

@asimwaleed
Copy link

asimwaleed commented Apr 28, 2021

i also got this error.
Go through this link (code line 212-220), may be it's an issue of emulator

@nikagersonlohman
Copy link
Author

I have the same issue in the car (Volvo XC40)...

@frankkienl
Copy link

You could try to file the issue here:
https://issuetracker.google.com/issues?q=componentid:460472%20status:open#
That may help.

@TIB28
Copy link

TIB28 commented Jun 18, 2021

Hi @nikagersonlohman , got the same problem, did you fix it ?

@nikagersonlohman
Copy link
Author

No, sorry, I abandoned it because they denied testing the app further in my car as it's not a media app which is the only allowed currently :(

@andrewmbenton
Copy link

I know this is slightly off-topic but I saw that you did manage to install your testing app on an XC40 P8 via the Play Store and am wondering how you did that? I've set up testing channels for other apps and I think I did this one correctly (release type is Automotive OS). On the vehicle I'm signed in to the Google Account of one of my opted-in testers. But searching the Play Store on the vehicle turns up nothing. If you managed to do this successfully can you share the method?

@nikagersonlohman
Copy link
Author

nikagersonlohman commented Jun 25, 2021

Hi Andrew,

I think it must have been a mistake. When I submitted the app a second time with hardly any changes, they denied it into the test phase...

This is what I got in February:
image

And this is what I got last month:
image

Regards,

Nika.

@andrewmbenton
Copy link

My app has been approved for testing but yes presumably they will reject it at some point.

During the brief period when your app was approved for testing did you manage to run it on the car?

@nikagl
Copy link

nikagl commented Jun 25, 2021

Yes, and it's still running in it...

🤷‍♂️

@andrewmbenton
Copy link

How did you manage to install? On the vehicle did you just search the Play Store from a tester's google account?

@SergeyStepanov
Copy link

Hi. I realize that my answer is already late, but I ran into this problem myself and I was able to solve it. So I am writing for those who will encounter it.

It is not enough to specify the permissions in the manifest. You need to request them in the GUI. I used the following example:

private val permissions = arrayOf(Car.PERMISSION_SPEED)

override fun onResume() {
        super.onResume()
        if(checkSelfPermission(permissions[0]) == PackageManager.PERMISSION_GRANTED) {
            //your code here
        } else {
            requestPermissions(permissions, 0)
        }
    }

@nikagersonlohman
Copy link
Author

How did you manage to install? On the vehicle did you just search the Play Store from a tester's google account?

It's a bit too long ago, I do not remember exactly, but I do remember it didn't show up initially. I had to setup beta in Google Play too. If I remember correctly I clicked like 10 times on the play store version and it said I am a developer (like developer options in android, which doesn't work in the car; it did work here). Here's a screenshot of what I needed to enable (translated it says: internal share apps on google play, download and install test-versions of apps shared with you):
image

After that, it didn't work initially. I could find the app but couldn't install it:
image
image

But after a while, it suddenly installed and is still running (even when driving):
IMG_20210628_083618 (Large)
IMG_20210628_083628 (Large)
IMG_20210628_084434 (Large)
IMG_20210628_084524 (Large)
IMG_20210628_084531 (Large)
IMG_20210628_084538 (Large)
IMG_20210628_084551 (Large)
IMG_20210628_084612 (Large)

@nikagersonlohman
Copy link
Author

Hi. I realize that my answer is already late, but I ran into this problem myself and I was able to solve it. So I am writing for those who will encounter it.

It is not enough to specify the permissions in the manifest. You need to request them in the GUI. I used the following example:

private val permissions = arrayOf(Car.PERMISSION_SPEED)

override fun onResume() {
        super.onResume()
        if(checkSelfPermission(permissions[0]) == PackageManager.PERMISSION_GRANTED) {
            //your code here
        } else {
            requestPermissions(permissions, 0)
        }
    }

Superb! I'll try that soon on the emulator (as I can't get the app to publish to the car anymore :( )

@narko
Copy link

narko commented May 4, 2022

In case it helps, this file contains all the Car properties together with the required permissions:
https://cs.android.com/android/platform/superproject/+/master:packages/services/Car/car-lib/src/android/car/VehiclePropertyIds.java;l=30?q=VehiclePropertyIds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants