Best way to share Settings between 2 Apps on the Phone (Main App and Live Wallpaper)

RiverRaid

Active Member
Licensed User
Longtime User
Hi!

My App has 4 parts: Main App, Widgets, Live Wallpaper & DreamService

As most of my Users don't need LP and DS, i would like to cut it off from the main app and publish as add-on via android market.

The main app uses statemanager and sqlite to save some settings. What would be the best way, that the LP and DS (which need a differant packagename, i guess..) can access the data from the main app?

Thanks a lot!!
Andi
 

thedesolatesoul

Expert
Licensed User
Longtime User
Usually this would be done with Content Providers. However, you would need a Java lib for that, since usually content providers are specific.
Secondly, you can use Intents.
Thirdly, store the data on a known location on the sdcard where all the apps can access it.
I have used Intents and PackageManager to create a plugin mechanism for Cloudpipes.
 
Upvote 0

RiverRaid

Active Member
Licensed User
Longtime User
Thanks for the answers!!

@Erel: Okay, DBUtils stores the DB on External, so I would just have to manually receive the Path, that sounds quite easy :)

@thedesolatesoul: Could you give me a little hint (piece of code), I have no idea how implement your way:sign0085:
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
@thedesolatesoul: Could you give me a little hint (piece of code), I have no idea how implement your way:sign0085:
It is a bit complicated the way I did it, but here is what is involved:
Intent filters. In the manifest file you need to add intent filters for the intents you want to receive. You can create your own intent names.
Permissions. You can create permissions on those intent filters, to restrict only your apps to access them, although this is not necessary.
Intents. Here you actually build your intents. However, to get the data back, its better to implement onResult, so once the intent is delivered the other app can return data back to you via a ReturnIntent.

The code again is very specific for cases. I'll see if I can find an example I did a while ago.
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
Upvote 0

RiverRaid

Active Member
Licensed User
Longtime User
Wow,thank your very, very much, thats georgious! :sign0087: There are a lot of possibilities with your solution! :)
 
Upvote 0
Top