Page 1 of 1

Android Auto autostart - autofocs

Posted: Sun Apr 26, 2026 6:57 pm
by ronabrak
Hi all,

I'm new to Hudiy and have a question about the autostart function of Android Auto.
Autostart is working just fine, but is also taking focus after starting.

I would like Android Auto to autostart but let the main menu stay in focus until I activate Android Auto using a button on the bottumbar using the resume command.

Is this possible??
Whatever I try, as soon as hudiy starts, Android Auto get the focus.

Thanx in advance.
Ronald

Re: Android Auto autostart - autofocs

Posted: Sun Apr 26, 2026 7:24 pm
by hudiy
Hello.

Yes, you can do this via the Hudiy API.

The Hudiy API allows you to monitor the status of the Android Auto / CarPlay projection. In a script, when the projection changes its state from inactive to active for the first time, you can trigger an action that will display the selected screen (e. g. main menu), thereby hiding the Android Auto projection. Information on how to use the Hudiy API and how to run such scripts at startup can be found in the documentation available on our GitHub:

https://github.com/wiboma/hudiy/tree/main/examples
https://github.com/wiboma/hudiy/tree/ma ... api/python
https://github.com/wiboma/hudiy/blob/ma ... md#actions
https://github.com/wiboma/hudiy/blob/ma ... figuration
https://github.com/wiboma/hudiy/tree/ma ... obd_charts
https://github.com/wiboma/hudiy/tree/ma ... dle_screen
https://github.com/wiboma/hudiy/blob/main/api/Api.proto

Code: Select all

import common.Api_pb2 as hudiy_api
import time
from common.Client import Client, ClientEventHandler


class EventHandler(ClientEventHandler):

    def __init__(self):
        self._activated = False

    def on_hello_response(self, client, message):
        print(
            "received hello response, result: {}, app version: {}.{}, api version: {}.{}"
            .format(message.result, message.app_version.major,
                    message.app_version.minor, message.api_version.major,
                    message.api_version.minor))

        set_status_subscriptions = hudiy_api.SetStatusSubscriptions()
        set_status_subscriptions.subscriptions.append(
            hudiy_api.SetStatusSubscriptions.Subscription.PROJECTION)
        client.send(hudiy_api.MESSAGE_SET_STATUS_SUBSCRIPTIONS, 0,
                    set_status_subscriptions.SerializeToString())

    def on_projection_status(self, client, message):
        print("projection status, active: {}".format(message.active))

        if not self._activated and message.active:
            self._activated = True

            dispatch_action = hudiy_api.DispatchAction()
            dispatch_action.action = "applications_menu"
            client.send(hudiy_api.MESSAGE_DISPATCH_ACTION, 0,
                    dispatch_action.SerializeToString())


def main():
    client = Client("projection status example")
    event_handler = EventHandler()
    client.set_event_handler(event_handler)

    try:
        while True:
            try:
                client.connect('127.0.0.1', 44405)
                while True:
                    if not client.wait_for_message():
                        break
            except Exception:
                pass
            time.sleep(2)
    except KeyboardInterrupt:
        pass
    finally:
        client.disconnect()


if __name__ == "__main__":
    main()

Re: Android Auto autostart - autofocs

Posted: Mon Apr 27, 2026 8:28 am
by ronabrak
Thank you,

Together with Claude, I managed to get it to work.