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


Java IWeiboShareAPI类代码示例

本文整理汇总了Java中com.sina.weibo.sdk.api.share.IWeiboShareAPI的典型用法代码示例。如果您正苦于以下问题:Java IWeiboShareAPI类的具体用法?Java IWeiboShareAPI怎么用?Java IWeiboShareAPI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IWeiboShareAPI类属于com.sina.weibo.sdk.api.share包,在下文中一共展示了IWeiboShareAPI类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shareToWeibo

import com.sina.weibo.sdk.api.share.IWeiboShareAPI; //导入依赖的package包/类
public static void shareToWeibo(String transaction, Activity activity, String title, String summary, Bitmap img) {
    ImageObject imageObject = new ImageObject();
    imageObject.imageData = bmpToByteArray(img);

    TextObject textObject = new TextObject();
    textObject.text = title + "\n" + summary + Constants.SUMMARY;

    WeiboMultiMessage message = new WeiboMultiMessage();
    message.textObject = textObject;
    message.imageObject = imageObject;

    SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
    request.transaction = transaction;
    request.multiMessage = message;

    AuthInfo authInfo = new AuthInfo(activity, Constants.WB_APP_ID, Constants.WB_REDIRECT_URL, Constants.WB_SCOPE);
    Oauth2AccessToken accessToken = AccessTokenKeeper.readAccessToken(APP_CONTEXT);
    String token = "";
    if (accessToken != null) {
        token = accessToken.getToken();
    }
    IWeiboShareAPI api = getWbApi();
    api.sendRequest(activity, request, authInfo, token, weiboAuthListener);
}
 
开发者ID:qiujuer,项目名称:UPMiss,代码行数:25,代码来源:Share.java

示例2: getInstance

import com.sina.weibo.sdk.api.share.IWeiboShareAPI; //导入依赖的package包/类
public static IWeiboShareAPI getInstance(Context context, String appKey) {
    LogUtil.enableLog();
    if (null == api) {
        api = WeiboShareSDK.createWeiboAPI(context, appKey);
        api.registerApp();
    }

    return api;
}
 
开发者ID:yangjie127,项目名称:ESSocialSDK-master,代码行数:10,代码来源:WeiboShareProxy.java

示例3: shareLocalImage

import com.sina.weibo.sdk.api.share.IWeiboShareAPI; //导入依赖的package包/类
private void shareLocalImage(IWeiboShareAPI api, Share share, Callback callback) {
    WeiboMultiMessage msg = new WeiboMultiMessage();
    ImageObject img = new ImageObject();
    img.setImageObject(share.getThumbBitmap());
    msg.imageObject = img;
    SendMultiMessageToWeiboRequest multRequest = new SendMultiMessageToWeiboRequest();
    multRequest.multiMessage = msg;
    //以当前时间戳为唯一识别符
    multRequest.transaction = String.valueOf(System.currentTimeMillis());
    if (api.sendRequest(activity, multRequest)) {
        callback.onSuccess();
    } else {
        callback.onFailed();
    }
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:16,代码来源:OpenBuilder.java

示例4: getWbApi

import com.sina.weibo.sdk.api.share.IWeiboShareAPI; //导入依赖的package包/类
private synchronized static IWeiboShareAPI getWbApi() {
    if (WB_API == null) {
        IWeiboShareAPI mWeiboShareAPI = WeiboShareSDK.createWeiboAPI(APP_CONTEXT, Constants.WB_APP_ID);
        mWeiboShareAPI.registerApp();
        WB_API = mWeiboShareAPI;
    }
    return WB_API;
}
 
开发者ID:qiujuer,项目名称:UPMiss,代码行数:9,代码来源:Share.java

示例5: onCreate

import com.sina.weibo.sdk.api.share.IWeiboShareAPI; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.sina_activity);
    ButterKnife.bind(this);

    authInfo = new AuthInfo(SinaActivity.this, SINA_APPID, SINA_REDIRECT_URL, SINA_SCOPE);
    ssoHandler = new SsoHandler(SinaActivity.this, authInfo);

    IWeiboShareAPI weiboShareAPI = WeiboShareSDK.createWeiboAPI(SinaActivity.this, SINA_APPID);
    weiboShareAPI.registerApp();
}
 
开发者ID:BruceHurrican,项目名称:asstudydemo,代码行数:13,代码来源:SinaActivity.java

示例6: isInstall

import com.sina.weibo.sdk.api.share.IWeiboShareAPI; //导入依赖的package包/类
@Override
public boolean isInstall(Context context) {
    IWeiboShareAPI shareAPI =
            WeiboShareSDK.createWeiboAPI(context, ShareManager.CONFIG.getWeiboId());
    return shareAPI.isWeiboAppInstalled();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:WeiboLoginInstance.java

示例7: isWeiBoInstalled

import com.sina.weibo.sdk.api.share.IWeiboShareAPI; //导入依赖的package包/类
@Deprecated
public static boolean isWeiBoInstalled(@NonNull Context context) {
    IWeiboShareAPI shareAPI =
            WeiboShareSDK.createWeiboAPI(context, ShareManager.CONFIG.getWeiboId());
    return shareAPI.isWeiboAppInstalled();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:ShareUtil.java

示例8: getWeiboApi

import com.sina.weibo.sdk.api.share.IWeiboShareAPI; //导入依赖的package包/类
public static IWeiboShareAPI getWeiboApi() {
	return sWeiboApi;
}
 
开发者ID:fengyanjava,项目名称:msb-android,代码行数:4,代码来源:ShareApis.java

示例9: shareToXinLangWeibo

import com.sina.weibo.sdk.api.share.IWeiboShareAPI; //导入依赖的package包/类
/**
 * 分享到新浪微博
 * @param activity      上下文
 * @param shareContent  分享内容
 */
static void shareToXinLangWeibo(Activity activity, ShareContent shareContent) {
	DebugLog.d(TAG, "shareToXinLangWeibo() shareContent = " + shareContent);
	
	IWeiboShareAPI weiboShareAPI = WeiboShareSDK.createWeiboAPI(activity, MyApp.getApp().d());
	weiboShareAPI.registerApp();
	
	if (weiboShareAPI.isWeiboAppSupportAPI()) {
           int supportApi = weiboShareAPI.getWeiboAppSupportAPI();
           if (supportApi >= 10351 /*ApiUtils.BUILD_INT_VER_2_2*/) {
           	WeiboMultiMessage weiboMessage = new WeiboMultiMessage();
           	
           	TextObject textObject = new TextObject();
               textObject.text = shareContent.getSummary();
           	weiboMessage.textObject = textObject;
           	
           	ImageObject imageObject = new ImageObject();
               imageObject.setImageObject(((BitmapDrawable)activity.getResources().getDrawable(R.drawable.ic_logo)).getBitmap());
           	weiboMessage.imageObject = imageObject;
           	
           	WebpageObject mediaObject = new WebpageObject();
               mediaObject.identify = Utility.generateGUID();
               mediaObject.title = shareContent.getTitle();
               mediaObject.description = shareContent.getSummary();
               
               // 设置 Bitmap 类型的图片到视频对象里
               mediaObject.setThumbImage(((BitmapDrawable)activity.getResources().getDrawable(R.drawable.ic_logo)).getBitmap());
               mediaObject.actionUrl = shareContent.getLinkUrl();
               mediaObject.defaultText = shareContent.getSummary();
           	weiboMessage.mediaObject = mediaObject;
           	
           	// 2. 初始化从第三方到微博的消息请求
               SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
               // 用transaction唯一标识一个请求
               request.transaction = String.valueOf(System.currentTimeMillis());
               request.multiMessage = weiboMessage;
               
               // 3. 发送请求消息到微博,唤起微博分享界面
               weiboShareAPI.sendRequest(activity, request);
           } else {
               
           }
       } else {
           Toast.makeText(activity, R.string.third_party_weibo_hint, Toast.LENGTH_SHORT).show();
       }
}
 
开发者ID:leleliu008,项目名称:Newton_for_Android_AS,代码行数:51,代码来源:ShareUtils.java


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