Reputation: 41
So I am making this app . I wanna have an app for free and a paid version too. I tried searching on google on how to implement it, but I couldnt find any proper threads. From some research I see In-app purchases is an option , but I'm not entirely clear. Can someone explain to me how this can be done? Thanks
Upvotes: 1
Views: 1761
Reputation: 2825
You have to use flavors to achieve what you want. You need to have two different application id for each version. It will create *.apk with different id for free and paid version and therefore you will be able to upload two separate apps on Google Play.
android {
productFlavors {
free {
applicationId "com.myapp.free"
}
paid {
applicationId "com.myapp.paid"
}
}
}
Free version is build with:
gradlew assembleFreeRelease
Paid version is build with:
gradlew assemblePaidRelease
Your actual package can be different than application id:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.myapp">
</manifest>
In code you can check what flavor is used:
if (BuildConfig.FLAVOR.equals("free")) {
//do sth only for free version
}
Upvotes: 5