当前位置: 首页>>代码示例>>Java>>正文


Java Activity.getCallingActivity方法代码示例

本文整理汇总了Java中android.app.Activity.getCallingActivity方法的典型用法代码示例。如果您正苦于以下问题:Java Activity.getCallingActivity方法的具体用法?Java Activity.getCallingActivity怎么用?Java Activity.getCallingActivity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.app.Activity的用法示例。


在下文中一共展示了Activity.getCallingActivity方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: extractCallerAuthDomains

import android.app.Activity; //导入方法依赖的package包/类
/**
 * Extracts the set of authentication domains for the caller of the provided activity.
 */
@NonNull
public static Set<AuthenticationDomain> extractCallerAuthDomains(@NonNull Activity activity) {
    ComponentName callingActivity = activity.getCallingActivity();
    if (callingActivity == null) {
        return Collections.emptySet();
    }

    String callingPackage = callingActivity.getPackageName();
    AuthenticationDomain authenticationDomain =
            AuthenticationDomain.fromPackageName(activity, callingPackage);
    if (null == authenticationDomain) {
        return Collections.EMPTY_SET;
    }

    return new HashSet<>(Arrays.asList(authenticationDomain));
}
 
开发者ID:openid,项目名称:OpenYOLO-Android,代码行数:20,代码来源:CallerUtil.java

示例2: initializeCallingPackage

import android.app.Activity; //导入方法依赖的package包/类
private void initializeCallingPackage(final Activity activity) {
    ComponentName componentName = activity.getCallingActivity();
    if (componentName == null) {
        return;
    }
    callingPackage = componentName.getPackageName();
}
 
开发者ID:eviltnan,项目名称:kognitivo,代码行数:8,代码来源:LoginFragment.java

示例3: getCallingActivity

import android.app.Activity; //导入方法依赖的package包/类
public static ComponentName getCallingActivity(Activity calledActivity) {
    ComponentName result = calledActivity.getCallingActivity();
    if (result == null) {
        return (ComponentName) calledActivity.getIntent().getParcelableExtra(EXTRA_CALLING_ACTIVITY);
    }
    return result;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:8,代码来源:ShareCompat.java

示例4: setSourceApplication

import android.app.Activity; //导入方法依赖的package包/类
/**
 * Source Application setters and getters
 */
private static void setSourceApplication(Activity activity) {

    ComponentName callingApplication = activity.getCallingActivity();
    if (callingApplication != null) {
        String callingApplicationPackage = callingApplication.getPackageName();
        if (callingApplicationPackage.equals(activity.getPackageName())) {
            // open by own app.
            resetSourceApplication();
            return;
        }
        sourceApplication = callingApplicationPackage;
    }

    // Tap icon to open an app will still get the old intent if the activity was opened by an
    // intent before. Introduce an extra field in the intent to force clear the
    // sourceApplication.
    Intent openIntent = activity.getIntent();
    if (openIntent == null ||
            openIntent.getBooleanExtra(SOURCE_APPLICATION_HAS_BEEN_SET_BY_THIS_INTENT, false)) {
        resetSourceApplication();
        return;
    }

    Bundle applinkData = AppLinks.getAppLinkData(openIntent);

    if (applinkData == null) {
        resetSourceApplication();
        return;
    }

    isOpenedByApplink = true;

    Bundle applinkReferrerData = applinkData.getBundle("referer_app_link");

    if (applinkReferrerData == null) {
        sourceApplication = null;
        return;
    }

    String applinkReferrerPackage = applinkReferrerData.getString("package");
    sourceApplication = applinkReferrerPackage;

    // Mark this intent has been used to avoid use this intent again and again.
    openIntent.putExtra(SOURCE_APPLICATION_HAS_BEEN_SET_BY_THIS_INTENT, true);

    return;
}
 
开发者ID:eviltnan,项目名称:kognitivo,代码行数:51,代码来源:AppEventsLogger.java

示例5: initializeCallingPackage

import android.app.Activity; //导入方法依赖的package包/类
private void initializeCallingPackage(Activity activity) {
    ComponentName componentName = activity.getCallingActivity();
    if (componentName != null) {
        this.callingPackage = componentName.getPackageName();
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:7,代码来源:LoginFragment.java


注:本文中的android.app.Activity.getCallingActivity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。