No `tray__authority` anymore!

As you probably know I’m a contributor (and member 😉) of Tray. Tray is a SharedPreferences replacement with benefits. The main reason to develop it was the ability to use a simple store mechanism working in multiprocess environments. But it brings also the benefit of a way easier API than the default SharedPreferences. No Editor, no commit() or apply().

Anyway. This is not about the gorgeous API or the ability of separating settings via TrayPreferences. This is about the setup of Tray.

The process of setup Tray was a little bit weird. You have to declare a resValue called tray__authority in your module build.gradle like this:

resValue "string", "tray__authority", "${applicationId}.tray"

Because we use a ContentProvider underneath we need a unique authority for it. And this snipped will inject the given resValue to the ContentProvider as authority.

As you can see on that example above we do recommend a authority based on your applicationId plus the suffix .tray. We recommend it but it is not mandatory to use it like that. You can also choose any @StringRes you want.

To simplify the process one contributor came up with the idea to set the authority automatically. Which leads, obviously, to a much more simpler process of including the library.

Et voilà. With the next version (will be probably 0.12.0) we will automatically use ${applicationId}.tray as the default authority. No tray__authority anymore!

The downside of that change is — if you update Tray to the specific version — you have to adjust it a little bit. But trust me it is not that much to do 🙂.

There a two use cases. The first one is that you have set the tray__authority like we recommend. The second one is that you have set a custom authority.

If you have set the old authority to the new default value (${applicationId}.tray) the update is simple. Just remove the resValue config in your build.gradle. Simple, isn’t it?

But if you have set a custom authority — which means if you have something like this:

resValue "string", "tray__authority", "a.custom.tray.authority"

you have to override the TrayContentProvider in your AndroidManifest.
To use your custom authority just put the following code into your <application> tag:

tools:replace="android:authorities" />

That’s it. Our ContentProvider uses now the custom authority instead of the default one.

But there is one more config to mention: productFlavors.
If you have a custom authority for Tray in a specific flavor in your build.gradle it will not work either. You have to — like changing the AndroidManifest in your main sourceSet — change (or create) the AndroidManifest in your flavor sourceSet.

Lets’ give me an example.
If you have the following flavor:

productFlavors {
dev {
// resValue "string", "tray__autho... // Don't use it anymore!

you have to create a (or edit) the manifest in


That’s all for now. If you have any question with the migration or general feedback don’t shy to reach us at GitHub. We are very welcome to new contributors and improvements.