Content Provider Settings¶
Content Provider Setup Guide¶
To optimize multi-process data collection, ft-sdk >= 1.6.14 uses ContentProvider. The SDK uses the following configuration by default, which adapts based on the application's applicationId.
<provider
android:name="com.ft.sdk.garble.db.FTContentProvider"
android:authorities="${applicationId}.com.ft.sdk.provider"
android:exported="false"
android:multiprocess="false">
</provider>
Custom Provider¶
If customization is required, you need to use tools:replace to override the provider settings and also set the corresponding meta-data.
The
android:authoritiesin theprovidermust match theandroid:valuein themeta-data.
<provider
tools:replace="android:authorities"
android:name="com.ft.sdk.garble.db.FTContentProvider"
android:authorities="com.custom.app.provider"
android:exported="false"
android:multiprocess="false">
</provider>
<meta-data
android:name="com.ft.sdk.PROVIDER_AUTHORITY"
android:value="com.custom.app.provider" />
Forcefully Remove Provider¶
It is generally not recommended to remove the SDK's default FTContentProvider. If the application must remove it due to Manifest compliance, component consolidation, or other special requirements, you can use tools:node="remove" in the main module's AndroidManifest.xml.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application>
<provider
android:name="com.ft.sdk.garble.db.FTContentProvider"
android:authorities="${applicationId}.ft_sdk_provider_removed"
tools:node="remove" />
</application>
</manifest>
If you have previously configured a custom android:authorities, the android:authorities in the removal configuration must also match, and the corresponding meta-data must be removed simultaneously:
After completing the configuration, please build the target variant and check the final merged AndroidManifest.xml in the application module's build/intermediates/merged_manifest/ directory to confirm that both com.ft.sdk.garble.db.FTContentProvider and com.ft.sdk.PROVIDER_AUTHORITY have been removed. The subdirectories generated by different Android Gradle Plugin versions may vary. You can search for the corresponding class name or meta-data name within the merged_manifest directory for confirmation.
After removing the provider, it is recommended to explicitly enable file caching to avoid continuing to rely on the default SQLite provider path.
Impact After Removing Provider
- The default SQLite cache path becomes unavailable. Versions of
ft-sdk1.7.2 and above will fall back to file caching. It is not recommended to remove the provider for versions below 1.7.2. FTSDKConfig.setFileDataStoreShadow(true)relies on the provider to read the SQLite cache. After removal, the shadow write mode will not take effect.- If
FTSDKConfig.setNeedTransformOldCache(true)is also configured, the old SQLite cache cannot be read after removing the provider. The migration of old cache will be skipped, and historical unsynchronized data may not be synced. - In multi-process scenarios, after removing the provider, the SDK's SQLite multi-process access path is no longer used. Please prioritize using
enableFileDataStore()and verify that data writing and reporting in each process meet expectations.