Random idea; widget support

YE3 months ago

Hey,

I have an idea that I want to implement, and I am trying to think of ways to do this. I have not found a good clean solution yet, but I wanted to ask your opinions. Idea is to have a widget for my android home screen, 1x1 grid, which has a green or red dot, showing whether my (only one) car is online or offline. I first thought about retrieving the offline/online status into the widget via the database record, however I quickly understood that refreshing each second is not a efficient or battery-healthy way to do this. I am now thinking about event forwarding possibly. What would your approaches be?

Anton Tananaev3 months ago

You can subscribe to websocket in your app and listen to the status updates there.

YE3 months ago

Would that work via postman? I am trying to search through the forum, but can't find a sort of working example. Do you possibly have a link?

Anton Tananaev3 months ago

I don't have a link, but I think it should be possible with postman. You can just check what the official web app does.

YE3 months ago

Okay thank you i'll see how far I come. To clarify for myself; I don't need event forwarding for this thus?

Anton Tananaev3 months ago

No.

YE3 months ago

I have read more then 20 threads, and also the api documentations. It's a little bit above my head. Would you possibly point me in the correct direction? I understand that I should use a websocket. What's more? Also understand that I need to have the Cookie with the session ID. But everything i've tried in postman gives 503 error. Are there other options that (i can make) work beside postmnan?

Anton Tananaev3 months ago

The easiest option is just to look at the official web app.

YE3 months ago

I don't exactly understand what you meant by that. Like in my running traccar server? Or the source code in the GitHub? And there in, to what should I exactly look?

Anton Tananaev3 months ago

Not the source code. Just look at the API requests in your browser when you're using the official app.

YE3 months ago

I've looked at them now, however; the online/offline status of a device is shown without any request state in the home page. How could this help me?

Anton Tananaev3 months ago

Request state? What do you mean?