Update data from the Mobile App to the Android Auto app

205 Views Asked by At

I was following this codelab Here as you can see there's a common Repository to share between the Mobile App and the Android Auto app (that runs in the DHU). I was wondering how to update a e.g a string in the Auto app from the Mobile app ? I have tried to use sharedprefs but as these two apps has different context I didn't succeed. Also content provider didn't work because two apps lives in two different hardware I guess. What are my other options ? Thanks for your help in advance.

2

There are 2 best solutions below

3
On

You could use Firebase's real-time database or another cloud service.

With real-time services you will change each variable easily

1
On

If you have two separate apps running in different contexts (e.g., a mobile app and an Android Auto app), sharing data between them can be challenging due to the sandboxed nature of Android apps for security reasons. However, you can consider a few approaches to achieve communication or data sharing between these apps:

  1. Using a Shared Database or File

  2. Content Provider with Permissions

  3. Using Broadcasts or Intents

  4. Custom Networking or API

  5. Shared Preferences (with Content Provider or File)