How to enable an additional kit when testing Android broadcasts?

I'm currently trying to test the Google App Invites application, but I find it difficult to test the broadcast function INSTALL_REFERRER without putting the application on the Play Store

To participate in the App Invite broadcast, an additional package called "com.google.android.gms.appinvite.REFERRAL_BUNDLE" is required and it is checked in AppInviteReferral as follows:

 public static boolean hasReferral(Intent referralIntent) { return referralIntent != null && referralIntent.getBundleExtra("com.google.android.gms.appinvite.REFERRAL_BUNDLE") != null; } 

When testing translations using adb shell am broadcast ... best we can do is add extra features, but there is no way to add an extra package. ( here )

Does anyone know how a package can be included as part of a broadcast?

+4
source share
1 answer

This post says that adding an additional package through adb is not possible. You can write a simple test application and send the application invitation what you want:

 Intent intent = new Intent("com.android.vending.INSTALL_REFERRER"); intent.setPackage("your_package"); Bundle bundle = new Bundle(); bundle.putString("com.android.vending.INSTALL_REFERRER", "your_invite_id"); bundle.putString("com.google.android.gms.appinvite.DEEP_LINK", "your_deep_link"); intent.putExtra("com.google.android.gms.appinvite.REFERRAL_BUNDLE", bundle); sendBroadcast(intent); 

I tested the google app in this way, but before trying to send the intent via adb too.

+1
source

Source: https://habr.com/ru/post/988486/


All Articles