@Test public void testGetUpdateAppIntent_NoUpdate_SameVersion() { PendingDynamicLinkData pendingDynamicLinkData = new PendingDynamicLinkData(createDynamicLinkDataWithMinVersion(MINIMUM_VERSION)); packageInfo.versionCode = MINIMUM_VERSION; Intent intent = pendingDynamicLinkData.getUpdateAppIntent(mockContext); assertNull(intent); }
@Nullable public Intent getUpdateAppIntent(@NonNull Context context) { int versionCode; if (getMinimumAppVersion() == 0) { return null; } try { versionCode = context .getPackageManager() .getPackageInfo(context.getApplicationContext().getPackageName(), 0) .versionCode; } catch (NameNotFoundException e) { return null; } if (versionCode < getMinimumAppVersion() && getRedirectUrl() != null) { return new Intent(Intent.ACTION_VIEW) .setData(getRedirectUrl()) .setPackage(GooglePlayServicesUtil.GOOGLE_PLAY_STORE_PACKAGE); } return null; }
PendingDynamicLinkData { @Nullable public Intent getUpdateAppIntent(@NonNull Context context) { int versionCode; if (getMinimumAppVersion() == 0) { return null; } try { versionCode = context .getPackageManager() .getPackageInfo(context.getApplicationContext().getPackageName(), 0) .versionCode; } catch (NameNotFoundException e) { return null; } if (versionCode < getMinimumAppVersion() && getRedirectUrl() != null) { return new Intent(Intent.ACTION_VIEW) .setData(getRedirectUrl()) .setPackage(GooglePlayServicesUtil.GOOGLE_PLAY_STORE_PACKAGE); } return null; } }
PendingDynamicLinkData { @Nullable public Intent getUpdateAppIntent(@NonNull Context context) { int versionCode; if (getMinimumAppVersion() == 0) { return null; } try { versionCode = context .getPackageManager() .getPackageInfo(context.getApplicationContext().getPackageName(), 0) .versionCode; } catch (NameNotFoundException e) { return null; } if (versionCode < getMinimumAppVersion() && getRedirectUrl() != null) { return new Intent(Intent.ACTION_VIEW) .setData(getRedirectUrl()) .setPackage(GooglePlayServicesUtil.GOOGLE_PLAY_STORE_PACKAGE); } return null; } @VisibleForTesting  PendingDynamicLinkData(DynamicLinkData dynamicLinkData); protected  PendingDynamicLinkData(
      @Nullable String deepLink, int minVersion, long clickTimestamp, @Nullable Uri redirectUrl); }
PendingDynamicLinkData { @Nullable public Intent getUpdateAppIntent(@NonNull Context context) { int versionCode; if (getMinimumAppVersion() == 0) { return null; } try { versionCode = context .getPackageManager() .getPackageInfo(context.getApplicationContext().getPackageName(), 0) .versionCode; } catch (NameNotFoundException e) { return null; } if (versionCode < getMinimumAppVersion() && getRedirectUrl() != null) { return new Intent(Intent.ACTION_VIEW) .setData(getRedirectUrl()) .setPackage(GooglePlayServicesUtil.GOOGLE_PLAY_STORE_PACKAGE); } return null; } @VisibleForTesting  PendingDynamicLinkData(DynamicLinkData dynamicLinkData); protected  PendingDynamicLinkData(
      @Nullable String deepLink, int minVersion, long clickTimestamp, @Nullable Uri redirectUrl); @Nullable Bundle getExtensions(); @Nullable Uri getLink(); int getMinimumAppVersion(); long getClickTimestamp(); @VisibleForTesting Uri getRedirectUrl(); @Nullable Intent getUpdateAppIntent(@NonNull Context context); }
PendingDynamicLinkData { @Nullable public Intent getUpdateAppIntent(@NonNull Context context) { int versionCode; if (getMinimumAppVersion() == 0) { return null; } try { versionCode = context .getPackageManager() .getPackageInfo(context.getApplicationContext().getPackageName(), 0) .versionCode; } catch (NameNotFoundException e) { return null; } if (versionCode < getMinimumAppVersion() && getRedirectUrl() != null) { return new Intent(Intent.ACTION_VIEW) .setData(getRedirectUrl()) .setPackage(GooglePlayServicesUtil.GOOGLE_PLAY_STORE_PACKAGE); } return null; } @VisibleForTesting  PendingDynamicLinkData(DynamicLinkData dynamicLinkData); protected  PendingDynamicLinkData(
      @Nullable String deepLink, int minVersion, long clickTimestamp, @Nullable Uri redirectUrl); @Nullable Bundle getExtensions(); @Nullable Uri getLink(); int getMinimumAppVersion(); long getClickTimestamp(); @VisibleForTesting Uri getRedirectUrl(); @Nullable Intent getUpdateAppIntent(@NonNull Context context);  }