android.app.Activity.getCallingActivity()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(420)

本文整理了Java中android.app.Activity.getCallingActivity()方法的一些代码示例,展示了Activity.getCallingActivity()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.getCallingActivity()方法的具体详情如下:
包路径:android.app.Activity
类名称:Activity
方法名:getCallingActivity

Activity.getCallingActivity介绍

暂无

代码示例

代码示例来源:origin: facebook/facebook-android-sdk

private void initializeCallingPackage(final Activity activity) {
  ComponentName componentName = activity.getCallingActivity();
  if (componentName == null) {
    return;
  }
  callingPackage = componentName.getPackageName();
}

代码示例来源:origin: facebook/facebook-android-sdk

String callingApplicationPackage = "";
ComponentName callingApplication = activity.getCallingActivity();
if (callingApplication != null) {
  callingApplicationPackage = callingApplication.getPackageName();

代码示例来源:origin: facebook/facebook-android-sdk

ComponentName callingApplication = activity.getCallingActivity();
if (callingApplication != null) {
  String callingApplicationPackage = callingApplication.getPackageName();

代码示例来源:origin: robolectric/robolectric

@Test
public void getCallingActivity_defaultsToNull() {
 Activity activity = Robolectric.setupActivity(Activity.class);
 assertNull(activity.getCallingActivity());
}

代码示例来源:origin: robolectric/robolectric

@Test
public void getCallingActivity_returnsSetValue() {
 Activity activity = Robolectric.setupActivity(Activity.class);
 ComponentName componentName = new ComponentName("com.example.package", "SomeActivity");
 ShadowActivity shadowActivity = shadowOf(activity);
 shadowActivity.setCallingActivity(componentName);
 assertEquals(componentName, activity.getCallingActivity());
}

代码示例来源:origin: airbnb/DeepLinkDispatch

newIntent.putExtra(DeepLink.IS_DEEP_LINK, true);
newIntent.putExtra(DeepLink.REFERRER_URI, uri);
if (activity.getCallingActivity() != null) {
 newIntent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);

代码示例来源:origin: com.uphyca/android-junit4-robolectric

/**
 * @return
 * @see android.app.Activity#getCallingActivity()
 */
public ComponentName getCallingActivity() {
  return mActivity.getCallingActivity();
}

代码示例来源:origin: iqiyi/Neptune

@Override
public android.content.ComponentName getCallingActivity() {
  return mOriginActivity.getCallingActivity();
}

代码示例来源:origin: com.google.android/support-v4

/**
 * Retrieve the ComponentName of the activity that launched calledActivity from a share intent.
 * Apps that provide social sharing functionality can use this to provide attribution
 * for the app that shared the content.
 *
 * <p><em>Note:</em> This data may have been provided voluntarily by the calling
 * application. As such it should not be trusted for accuracy in the context of
 * security or verification.</p>
 *
 * @param calledActivity Current activity that was launched to share content
 * @return ComponentName of the calling activity
 */
public static ComponentName getCallingActivity(Activity calledActivity) {
  ComponentName result = calledActivity.getCallingActivity();
  if (result == null) {
    result = calledActivity.getIntent().getParcelableExtra(EXTRA_CALLING_ACTIVITY);
  }
  return result;
}

代码示例来源:origin: kingargyle/adt-leanback-support

/**
 * Retrieve the ComponentName of the activity that launched calledActivity from a share intent.
 * Apps that provide social sharing functionality can use this to provide attribution
 * for the app that shared the content.
 *
 * <p><em>Note:</em> This data may have been provided voluntarily by the calling
 * application. As such it should not be trusted for accuracy in the context of
 * security or verification.</p>
 *
 * @param calledActivity Current activity that was launched to share content
 * @return ComponentName of the calling activity
 */
public static ComponentName getCallingActivity(Activity calledActivity) {
  ComponentName result = calledActivity.getCallingActivity();
  if (result == null) {
    result = calledActivity.getIntent().getParcelableExtra(EXTRA_CALLING_ACTIVITY);
  }
  return result;
}

代码示例来源:origin: NightscoutFoundation/xDrip

/**
 * Used by: plugin EditActivity.
 * 
 * Description as above.
 * 
 * This version also includes backwards compatibility with pre 4.2 Tasker versions.
 * At some point this function will be deprecated.
 * 
 * @param  editActivity the plugin edit activity, needed to test calling Tasker version
 * @see #setVariableReplaceKeys(Bundle, String[])
*/
public static boolean hostSupportsOnFireVariableReplacement( Activity editActivity ) {
  
  boolean supportedFlag = hostSupportsOnFireVariableReplacement( editActivity.getIntent().getExtras() );
  
  if ( ! supportedFlag ) {
    String callerPackage = (editActivity.getCallingActivity() != null) ? editActivity.getCallingActivity().getPackageName() : "null";
    
    // Tasker only supporteed this from 1.0.10
    supportedFlag = 
        ( callerPackage.startsWith( BASE_KEY ) ) &&
        ( getPackageVersionCode( editActivity.getPackageManager(), callerPackage ) > FIRST_ON_FIRE_VARIABLES_TASKER_VERSION )
    ;
  }
  
  return supportedFlag;
}

代码示例来源:origin: jamorham/xDrip-plus

/**
 * Used by: plugin EditActivity.
 * 
 * Description as above.
 * 
 * This version also includes backwards compatibility with pre 4.2 Tasker versions.
 * At some point this function will be deprecated.
 * 
 * @param  editActivity the plugin edit activity, needed to test calling Tasker version
 * @see #setVariableReplaceKeys(Bundle, String[])
*/
public static boolean hostSupportsOnFireVariableReplacement( Activity editActivity ) {
  
  boolean supportedFlag = hostSupportsOnFireVariableReplacement( editActivity.getIntent().getExtras() );
  
  if ( ! supportedFlag ) {
    String callerPackage = (editActivity.getCallingActivity() != null) ? editActivity.getCallingActivity().getPackageName() : "null";
    
    // Tasker only supporteed this from 1.0.10
    supportedFlag = 
        ( callerPackage.startsWith( BASE_KEY ) ) &&
        ( getPackageVersionCode( editActivity.getPackageManager(), callerPackage ) > FIRST_ON_FIRE_VARIABLES_TASKER_VERSION )
    ;
  }
  
  return supportedFlag;
}

代码示例来源:origin: markusfisch/ShaderEditor

protected View initView(
    Activity activity,
    LayoutInflater inflater,
    ViewGroup container) {
  View view = inflater.inflate(
      R.layout.fragment_sampler_properties,
      container,
      false);
  sizeCaption = view.findViewById(R.id.size_caption);
  sizeBarView = view.findViewById(R.id.size_bar);
  sizeView = view.findViewById(R.id.size);
  nameView = view.findViewById(R.id.name);
  addUniformView = view.findViewById(
      R.id.should_add_uniform);
  textureParameterView = view.findViewById(
      R.id.texture_parameters);
  progressView = view.findViewById(R.id.progress_view);
  if (activity.getCallingActivity() == null) {
    addUniformView.setVisibility(View.GONE);
    addUniformView.setChecked(false);
    textureParameterView.setVisibility(View.GONE);
  }
  initSizeView();
  initNameView();
  return view;
}

代码示例来源:origin: termux/termux-tasker

/**
 * Used by: plugin EditActivity.
 * <p>
 * Description as above.
 * <p>
 * This version also includes backwards compatibility with pre 4.2 Tasker versions.
 * At some point this function will be deprecated.
 *
 * @param editActivity the plugin edit activity, needed to test calling Tasker version
 * @see #setVariableReplaceKeys(Bundle, String[])
 */
public static boolean hostSupportsOnFireVariableReplacement(Activity editActivity) {
  boolean supportedFlag = hostSupportsOnFireVariableReplacement(editActivity.getIntent().getExtras());
  if (!supportedFlag) {
    ComponentName callingActivity = editActivity.getCallingActivity();
    if (callingActivity == null)
      Log.w(TAG, "hostSupportsOnFireVariableReplacement: null callingActivity, defaulting to false");
    else {
      String callerPackage = callingActivity.getPackageName();
      // Tasker only supported this from 1.0.10
      supportedFlag = (callerPackage.startsWith(BASE_KEY)) &&
              (getPackageVersionCode(editActivity.getPackageManager(), callerPackage) > FIRST_ON_FIRE_VARIABLES_TASKER_VERSION)
      ;
    }
  }
  return supportedFlag;
}

代码示例来源:origin: dc297/mqttclpro

/**
 * Used by: plugin EditActivity.
 * 
 * Description as above.
 * 
 * This version also includes backwards compatibility with pre 4.2 Tasker versions.
 * At some point this function will be deprecated.
 * 
 * @param  editActivity the plugin edit activity, needed to test calling Tasker version
 * @see #setVariableReplaceKeys(Bundle, String[])
*/
public static boolean hostSupportsOnFireVariableReplacement( Activity editActivity ) {
  
  boolean supportedFlag = hostSupportsOnFireVariableReplacement( editActivity.getIntent().getExtras() );
  
  if ( ! supportedFlag ) {
    String callerPackage = editActivity.getCallingActivity().getPackageName();
    
    // Tasker only supporteed this from 1.0.10
    supportedFlag = 
        ( callerPackage.startsWith( BASE_KEY ) ) &&
        ( getPackageVersionCode( editActivity.getPackageManager(), callerPackage ) > FIRST_ON_FIRE_VARIABLES_TASKER_VERSION )
    ;
  }
  
  return supportedFlag;
}

代码示例来源:origin: fr.avianey/facebook-android-api

ComponentName callingApplication = activity.getCallingActivity();
if (callingApplication != null) {
  String callingApplicationPackage = callingApplication.getPackageName();

相关文章

微信公众号

最新文章

更多

Activity类方法