free and paid app signed one keystore - android

I was sign 2 apps (free and paid) with one keystore but with different aliases and have the same versionName of free and paid app its 1.0 ofc. So, people who buy paid app cant install this paid app because they have free app on device. When they delete free app - instalation is good. The names of applications are different! Please help me understand what wrong? Thanks

An app is identified as 'unique' only by it's application ID.
They can use the same keystore alias, name etc. but as long as the application id is different they are different apps and can be installed next to each other.
A good approach would be to add a suffix to the free version such as 'lite'.
Assuming you have one app project with a 'free' and 'paid' flavour you could configure your build.gradle to use a different application id per flavour:
defaultConfig {
applicationId "com.example.awesomeapp"
}
productFlavors {
free {
applicationIdSuffix ".lite"
}
paid {
}
}
Please see the documentation on Application ID

Related

How to upload 2 different flavor apps in 1 playstore project

Following is my app package name
com.test.myapp
and I have created 2 product flavors, 1 for development & 1 for production like following.
productFlavors {
dev {
applicationId = "com.test.myapp.dev"
}
production {
applicationId = "com.test.myapp"
}
}
It works fine, when i launch app from android studio, it also creates signed apk fine, but when i try to upload development apk on play store, it gives following error message.
Your APK or Android App Bundle needs to have the package name
com.test.myapp.
Technically it is not possible, Google not allows this, you need to create 2 apps on Google play for this. But why you need flavor for development with different package name? does Google's Alpha testing not solve your problems?
Edit:
Based on comments the issue was how to load different strings.xml based on build config without creating new package name.
Solution:
flavorDimensions "dev"
productFlavors {
dev {
flavorDimensions "dev"
}
prod {
flavorDimensions "dev"
}
}
Create new strings.xml resource in dev source set
\src\dev\res\values\strings.xml
I have uploaded demo project:
https://github.com/pavelpoley/FlavorTest
More info you can find in docs:
https://developer.android.com/studio/build/build-variants#sourcesets

Does same package name APK(with different applicationId) use same data location?

we know APK save data in /data/data/PackageName,if two different apk with same package name,will they cover other's data?(like sharepreference's data)
The Answer is No, Why? This is not possible, Play store will not let you to upload an apk with the same package,Package name at play store is important for many reasons, one of them is update detection, if you updated an application the first thing Google pay attention is the package name in order to know what is the current release version.
Somehow it will be happened by same developer at the DEVELOPMENT stage only then you can name your package whatever do you want.
As far as same package name is concerned it's not possible to have installed on same device it will be replaced.
But if we have different appliationId, yes another app can be installed on same device but in that case packageName will also be change.
Working Sample
Project 1
app/build.gradle
applicationId "com.test.sample"
Android Manifest
package="com.test.sample"
Result
When i print applicationId and package name, it was same:
applicationId: "com.test.sample"
package: "com.test.sample"
Project 2
I've added buildTypes/flavor but keeping applicationId and package name same, but in that case outpout of applicationId and package name will be changed.
build.gradle(app)
applicationId "com.test.sample"
buildTypes {
release {
applicationIdSuffix ".release"
}
debug {
applicationIdSuffix ".debug"
}
}
Android Manifest
package="com.test.sample"
Result
When i print applicationId and package name, it was different:
applicationId: "com.test.sample.debug"
package: "com.test.sample.debug"
So that is how two applications are installed due to change in buildType/flavors(pro/free).
And if you want to access sharedPreferences of each-other (assume free/pro version) than you need to create a ContentProvider to expose data you need and grant permissions to paid app.

Can an app have multiple google-services.json files?

I have an android sdk which requires the app using it to have google-services.json file in its project directory.
I am wondering what will happen if the app already has a google-services.jsonfile from its implementation and is receiving FCMs from its own google developers console.
Can an app have multiple google-services.json file for the same flavor.
Can an app receive FCM's from two different google developers console account? or How can an app receive FCM's from two different google developers console?
I am just trying to explore ways as to how I can send FCM from my server to the app without making the app change its underlying design.
Downvoting must be accompanied with reason.
If you have multiple flavors configured in your app is intende to say that you will create multiple apps with different package name, for example:
flavorDimensions "mysite"
productFlavors {
elnorte {
applicationId 'com.jorgesys.creatorhdplayer'
manifestPlaceholders = [appName: "Creator hd player"]
dimension "mysite"
}
reforma {
applicationId 'com.jorgesys.creatorhdfree'
manifestPlaceholders = [appName: "Creator hd free"]
dimension "mysite"
}
mural {
applicationId 'com.jorgesys.creatorhd'
manifestPlaceholders = [appName: "Creator hd"]
dimension "mysite"
}
}
therefore you need to add diferent google-services.json files in your proyect for every application that needs google play services :
The google-services.json file is related to the package name so you just need one file for every application. The same if you have only one flavor configured (one application)

How to implement pro version android app

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
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
}

Add Flavors to the new version of published App

Is it possible to add Flavors to the new version of an already published App?
If yes, suppose the following senario:
I have a published app in Play Store (e.g. com.example.android). In the new version of the app I add (e.g. free and paid) Flavors. This addition changes the package name of the app to com.example.android.free and com.example.android.paid.
Suppose I publish only the com.example.android.free Flavor.
What will the link to the Play store be like?
https://play.google.com/store/apps/details?id=com.android.example (as it already was)
or it will be renamed to
https://play.google.com/store/apps/details?id=com.android.example.free
Just to be clear on the answer by marmor:
You CAN create flavours after you have a published application. But if you wish to keep the app published and updatable on Play Store that same app MUST have the original package name which means that it has to be one of the flavours created AND its package name left untouched.
As an example, imagine that you have one published app and then you decide that you want a FREE and a PRO version of it. You change your build.gradle file to have two flavours:
defaultConfig {
applicationId "com.mycompany.awesomeapp"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
flavorDimensions "feature"
productFlavors {
free{
}
pro{
applicationIdSuffix ".pro"
}
}
Now what this means is that the original app in the store is now the FREE product flavour and you can sign it and update it to the Play Store. You can even change its name. What matters is that its package name remains the same, in this case
com.mycompany.awesomeapp
which is the default defined and that uniquely identifies your app.
The PRO version is a different app now that you can publish and update as a new app. Its package name is now
com.mycompany.awesomeapp.pro
Meaning it is a new, different app, even though it shares some code base.
You can't change the package name of an already published app, you can however have two flavors free/paid, but one of them should have the original package name:
e.g.
free = com.example.android
paid = com.example.android.paid
which will mean the free app would update the currently existing one, and the paid app will be a new app on Google Play (with zero statistics and downloads).
the links to the 2 apps would be as expected:
https://play.google.com/store/apps/details?id=com.android.example
and
https://play.google.com/store/apps/details?id=com.android.example.paid
If you want to enjoy the best of both worlds, look into [in-app-billing][1] to allow your users to download the app for free, and pay within the app to unlock premium features.

Categories

Resources