I have two different android applications with different package names (app ids). These applications are for different user "roles". Is it possible to send invite to install/setup first application from second application using Google App Invites API?
Google App Invites between different android applications
320 Views Asked by Deinlandel At
2
There are 2 best solutions below
1

use following code
String firstAppPackageName = ""; //package name of app
try {
PackageManager pm = getPackageManager();
try {
pm.getPackageInfo(firstAppPackageName, PackageManager.GET_ACTIVITIES);
Toast.makeText(this, "already Installed", Toast.LENGTH_SHORT).show();
} catch (PackageManager.NameNotFoundException e) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + firstAppPackageName));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
} catch (android.content.ActivityNotFoundException anfe) {
}
What you are trying to do (send an invite to install app Y from app X) is not possible with the App Invites API. The intent of the API is for users to invite their friends/contacts/colleagues to use apps that they are already using and enjoying. So for that reason you can only recommend the current app.
However you could include a link to the second app as part of the deep link data. You could then do your own logic to implement something like this: