-
Notifications
You must be signed in to change notification settings - Fork 272
Custom Authority
Tray uses <applicationId>.tray
as authority for the internal ContentProvider
.
If you don't want to use the "default" authority you can define your own with the following code inside your AndroidManifest
:
<provider
android:name="net.grandcentrix.tray.provider.TrayContentProvider"
android:authorities="your.custom.authority"
android:exported="false"
tools:replace="android:authorities" />
Changing the authority from one app version to another app version is no problem! Tray always uses the same database.
A ContentProvider requires a unique authority across all installed apps. When you use the same authority for multiple apps you will be unable to install the app due to a authority conflict with the error message:
Failure [INSTALL_FAILED_CONFLICTING_PROVIDER]
Make sure you set a different authority for debug and release builds as well as different build flavors.
If you are using different applicationIds for different buildTypes of flavors, there are several methods to overcome this problem:
- If you only want to separate debug and release build or distinct between different flavors, read this article.
- If you want to have
{applicationId}[.flavor][.buildType]
, you may use thebuildVariant
overlay by- removing all
resValue ...
lines frombuild.gradle
- create
strings.xml
for each overlays (such asflavor1
,flavor1Debug
,flavor2
,flavor2Debug
) - specifying
<string name="tray__authority">your.application.id.flavor.buildType.tray</string>
in eachstrings.xml
-
NOTE for this method, you would have to create the appropriate
strings.xml
for everybuildVariant
, or it fall-back todefaultVariant
.
- removing all