My application has two versions, a free and pro version and the Content Provider for the app data needs to be shared between the two.
It should be designed keeping the following in mind
Possible solutions:
Please let me know if this makes sense and follows best practices with respect to shared content providers. Do share any other ways of doing this.
The ContentProvider instance manages access to a structured set of data by handling requests from other applications. All forms of access eventually call ContentResolver , which then calls a concrete method of ContentProvider to get access.
To access the content, define a content provider URI address. Create a database to store the application data. Implement the six abstract methods of ContentProvider class. Register the content provider in AndroidManifest.
A content provider manages access to a central repository of data. A provider is part of an Android application, which often provides its own UI for working with the data. However, content providers are primarily intended to be used by other applications, which access the provider using a provider client object.
I have 3 apps in the market each having a free and a paid version. For a given app, I have 100% code in a Android Shared lib project which is referenced from both the Free and Paid projects. These Free and Paid Android projects are just dummy projects and are only useful for its AndroidManifest.xml.
If you wish to enable/disable some functionality, you can always add the relevant check in the Shared lib based on the package name.
In your code (in the shared lib), you can distinguish between Free or Paid and enable/disable features based on the calling package.
if ("com.example.paid".equals(context.getPackageName()) {
//enable pro version features
}
Can you not do something similar? This will save you a lot of maintenance overhead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With