當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。