I see that some apps on the market come as a Free version, and a “Licensing add-on”, where you can use the Free version with its limited features, or buy the license apk which just acts as a license key for the originally “Free” version, to unlock extra features hidden within the “free” version.
Can someone point me to an example of how this can be done?
You can use the
PackageManager‘sgetInstalledPackages()orgetInstalledApplications()to simply check if the license package is installed.Or, if you want something a bit more sophisticated, you can give the main app and the license apk the same user id in the manifest. This means that both apps can have access to your data (Shared Preferences, SQLite DB, etc). Then the license app just needs to be run once; it can store a value in the shared data indicating that the extended functionality should be enabled. The main app just needs to check this flag and alter its behaviour accordingly.
The advantage of the second approach is that the license app can be uninstalled after being run, and the main app will continue to allow the extended functionality.