Code example for Intent

Methods: setClassNamesetFlags

0
 
  @Test 
  public void resolveService__Match() throws Exception { 
    Intent i = new Intent(Intent.ACTION_MAIN, null);
    ResolveInfo info = new ResolveInfo();
    rpm.addResolveInfoForIntent(i, info);
    assertThat(rpm.resolveService(i, 0)).isSameAs(info);
  } 
 
  @Test 
  public void removeResolveInfosForIntent_shouldCauseResolveActivityToReturnNull() throws Exception { 
    Intent intent = new Intent(Intent.ACTION_MAIN, null).addCategory(Intent.CATEGORY_LAUNCHER);
    ResolveInfo info = new ResolveInfo();
    info.nonLocalizedLabel = TEST_PACKAGE_LABEL;
    info.activityInfo = new ActivityInfo();
    info.activityInfo.packageName = "com.org";
    rpm.addResolveInfoForIntent(intent, info);
 
    rpm.removeResolveInfosForIntent(intent, "com.org");
 
    assertThat(rpm.resolveActivity(intent, 0)).isNull();