docs: public static boolean checkAppBeforeAuth(Context context, String appKey, boolean alertUser) {
          // Check if the app has set up its manifest properly.
          Intent testIntent = new Intent(Intent.ACTION_VIEW);
          String scheme = "db-" +appKey;
          String uri = scheme + "://" + AUTH_VERSION + AUTH_PATH_CONNECT;
          testIntent.setData(Uri.parse(uri));
          PackageManager pm = context.getPackageManager();
          List<ResolveInfo> activities = pm.queryIntentActivities(testIntent, 0);
  
          if (null == activities || 0 == activities.size()) {
              throw new IllegalStateException("URI scheme in your app's " +
                      "manifest is not set up correctly. You should have a " +
                      AuthActivity.class.getName() + " with the " +
                      "scheme: " + scheme);
          } else if (activities.size() > 1) {
              if (alertUser) {
                  AlertDialog.Builder builder = new AlertDialog.Builder(context);
                  builder.setTitle("Security alert");
                  builder.setMessage("Another app on your phone may be trying to " +
                          "pose as the app you are currently using. The malicious " +
                          "app can't access your account, but linking to Dropbox " +
                          "has been disabled as a precaution. Please contact " +
                          "support@dropbox.com.");
                  builder.setPositiveButton("OK", new OnClickListener() {
                      @Override
                      public void onClick(DialogInterface dialog, int which) {
                          dialog.dismiss();
                      }
                  });
                  builder.show();
              } else {
                  Log.w(TAG, "There are multiple apps registered for the AuthActivity " +
                          "URI scheme (" + scheme + ").  Another app may be trying to " +
                          " impersonate this app, so authentication will be disabled.");
              }
              return false;
          } else {
              // Just one activity registered for the URI scheme. Now make sure
              // it's within the same package so when we return from web auth
              // we're going back to this app and not some other app.
              ResolveInfo resolveInfo = activities.get(0);
              if (null == resolveInfo || null == resolveInfo.activityInfo
                      || !context.getPackageName().equals(resolveInfo.activityInfo.packageName)) {
                  throw new IllegalStateException("There must be a " +
                          AuthActivity.class.getName() + " within your app's package " +
                          "registered for your URI scheme (" + scheme + "). However, " +
                          "it appears that an activity in a different package is " +
                          "registered for that scheme instead. If you have " +
                          "multiple apps that all want to use the same access" +
                          "token pair, designate one of them to do " +
                          "authentication and have the other apps launch it " +
                          "and then retrieve the token pair from it.");
              }
          }
  
          return true;
      }