1

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?

Deinlandel
  • 1,023
  • 8
  • 25
  • 1
    This would be useful IMO. Would be nice to invite users to related apps or invite to a different product flavor (i.e. invite from paid flavor to free flavor). – Patrick Jackson Feb 15 '16 at 19:39

2 Answers2

3

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:

  1. Bob uses app X and invites Alice to use it.
  2. Alice gets the invite and installs app X.
  3. App X parses the deep link and says to Alice "You may also be interested in App Y, would you like to see it in the Play Store?"
  4. Alice can decide if she also wants App Y.
Sam Stern
  • 24,624
  • 13
  • 93
  • 124
0

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) {

    }
DaniZ
  • 596
  • 4
  • 4
  • As far as I can understand, this code just checks whether first application is installed on the SAME device and opens google Play if not installed. Unfortunately, that's not what I need. – Deinlandel Aug 07 '15 at 10:57