Java Code Examples for com.sina.weibo.sdk.api.share.WeiboShareSDK

The following examples show how to use com.sina.weibo.sdk.api.share.WeiboShareSDK. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Android-Application-ZJB   Source File: ShareModel.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 分享界面初始化各个分享平台的信息
 *
 * @param context        WXEntryActivity
 * @param intent         WXEntryActivity.getintent
 * @param handleResponse 是否要处理回调类型 savedInstanceState != null
 */
public void initPlatforms(Context context, Intent intent, boolean handleResponse) {
    mContext = context;
    //1.得到分享的Activity
    WXEntryActivity activity = (WXEntryActivity) context;
    //2.初始化微博平台的信息
    //2.1.创建分享API实例
    mWeiboShareAPI = WeiboShareSDK.createWeiboAPI(activity, ShareConstant.SINA_APP_KEY);
    //2.2.注册app,微博的注册需要放到点击的时候进入的哦
    //mWeiboShareAPI.registerApp();
    //2.3.当 Activity 被重新初始化时(该 Activity 处于后台时,可能会由于内存不足被杀掉了),
    // 需要调用 {@link IWeiboShareAPI#handleWeiboResponse} 来接收微博客户端返回的数据。
    // 执行成功,返回 true,并调用 {@link IWeiboHandler.Response#onResponse};
    // 失败返回 false,不调用上述回调
    if (handleResponse) {
        handleWeiboResponse(intent, activity);
    }
    //3.初始化QQ分享相关
    mTencent = Tencent.createInstance(ShareConstant.QQ_APP_KEY, activity);
}
 
Example 2
Source Project: ChinaShare   Source File: SinaShareImpl.java    License: MIT License 5 votes vote down vote up
public SinaShareImpl(Activity activity, int resIcon, String title) {
    super(activity, resIcon, title);
    mAuthInfo = new AuthInfo(mActivity, ShareManager.getWeiboAppId(),
            ShareManager.getSinaRedirectUrl(), ShareManager.getScope());
    mSsoHandler = new SsoHandler(mActivity, mAuthInfo);

    // 创建微博分享接口实例
    mWeiboShareAPI = WeiboShareSDK.createWeiboAPI(mActivity, ShareManager.getWeiboAppId());
    mWeiboShareAPI.registerApp();

    mAccessToken = AccessTokenKeeper.readAccessToken(mActivity);
}
 
Example 3
Source Project: SocialSDKAndroid   Source File: SinaWBHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate(Context context, PlatformConfig.Platform config) {
    this.mContext = context;
    this.mConfig = (PlatformConfig.SinaWB) config;

    this.mAuthInfo = new AuthInfo(mContext, mConfig.appKey, REDIRECT_URL, SCOPE);

    this.mWeiboShareAPI = WeiboShareSDK.createWeiboAPI(context, mConfig.appKey);
    this.mWeiboShareAPI.registerApp();
}
 
Example 4
Source Project: QiQuYing   Source File: SharePopWindow.java    License: Apache License 2.0 5 votes vote down vote up
private void initShareWeiboAPI() {
	if(mWeiboShareAPI == null) {
		mWeiboShareAPI = WeiboShareSDK.createWeiboAPI(context, com.sina.weibo.Constants.APP_KEY);
	}
	// 注册第三方应用到微博客户端中,注册成功后该应用将显示在微博的应用列表中。
       // 但该附件栏集成分享权限需要合作申请,详情请查看 Demo 提示
       // NOTE:请务必提前注册,即界面初始化的时候或是应用程序初始化时,进行注册
       mWeiboShareAPI.registerApp();
       mWeiboShareAPI.handleWeiboResponse(((Activity)context).getIntent(), this);
}
 
Example 5
Source Project: ESSocialSDK   Source File: WeiboShareProxy.java    License: Apache License 2.0 5 votes vote down vote up
public static IWeiboShareAPI getInstance(Context context, String appKey) {
    LogUtil.enableLog();
    if (null == api) {
        api = WeiboShareSDK.createWeiboAPI(context, appKey);
        api.registerApp();
    }

    return api;
}
 
Example 6
Source Project: ShareUtil   Source File: WeiboShareInstance.java    License: Apache License 2.0 4 votes vote down vote up
public WeiboShareInstance(Context context, String appId) {
    mWeiboShareAPI = WeiboShareSDK.createWeiboAPI(context, appId);
    mWeiboShareAPI.registerApp();
}
 
Example 7
Source Project: ShareUtil   Source File: WeiboLoginInstance.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public boolean isInstall(Context context) {
    IWeiboShareAPI shareAPI =
            WeiboShareSDK.createWeiboAPI(context, ShareManager.CONFIG.getWeiboId());
    return shareAPI.isWeiboAppInstalled();
}
 
Example 8
Source Project: ShareUtil   Source File: ShareUtil.java    License: Apache License 2.0 4 votes vote down vote up
@Deprecated
public static boolean isWeiBoInstalled(@NonNull Context context) {
    IWeiboShareAPI shareAPI =
            WeiboShareSDK.createWeiboAPI(context, ShareManager.CONFIG.getWeiboId());
    return shareAPI.isWeiboAppInstalled();
}
 
Example 9
Source Project: smart-farmer-android   Source File: WeiboShareInstance.java    License: Apache License 2.0 4 votes vote down vote up
public WeiboShareInstance(Context context, String appId) {
    mWeiboShareAPI = WeiboShareSDK.createWeiboAPI(context, appId);
    mWeiboShareAPI.registerApp();
}
 
Example 10
Source Project: smart-farmer-android   Source File: WeiboLoginInstance.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public boolean isInstall(Context context) {
    IWeiboShareAPI shareAPI =
            WeiboShareSDK.createWeiboAPI(context, ShareManager.CONFIG.getWeiboId());
    return shareAPI.isWeiboAppInstalled();
}
 
Example 11
Source Project: smart-farmer-android   Source File: ShareUtil.java    License: Apache License 2.0 4 votes vote down vote up
@Deprecated
public static boolean isWeiBoInstalled(@NonNull Context context) {
    IWeiboShareAPI shareAPI =
            WeiboShareSDK.createWeiboAPI(context, ShareManager.CONFIG.getWeiboId());
    return shareAPI.isWeiboAppInstalled();
}
 
Example 12
Source Project: the-tech-frontier-app   Source File: SharePresenter.java    License: MIT License 4 votes vote down vote up
public SharePresenter(Context context) {
    mWeiboShareAPI = WeiboShareSDK.createWeiboAPI(context, Constants.APP_KEY);
    mWeiboShareAPI.registerApp();
}