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


Java WeiboShareSDK类代码示例

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


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

示例1: onCreate

import com.sina.weibo.sdk.api.share.WeiboShareSDK; //导入依赖的package包/类
/**
   * @see {@link Activity#onCreate}
   */
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_share);
      initViews();

      mShareType = getIntent().getIntExtra(KEY_SHARE_TYPE, SHARE_CLIENT);
      
      // 创建微博分享接口实例
      mWeiboShareAPI = WeiboShareSDK.createWeiboAPI(this, Constants.APP_KEY);
      
      // 注册第三方应用到微博客户端中,注册成功后该应用将显示在微博的应用列表中。
      // 但该附件栏集成分享权限需要合作申请,详情请查看 Demo 提示
      // NOTE:请务必提前注册,即界面初始化的时候或是应用程序初始化时,进行注册
      mWeiboShareAPI.registerApp();
      
// 当 Activity 被重新初始化时(该 Activity 处于后台时,可能会由于内存不足被杀掉了),
      // 需要调用 {@link IWeiboShareAPI#handleWeiboResponse} 来接收微博客户端返回的数据。
      // 执行成功,返回 true,并调用 {@link IWeiboHandler.Response#onResponse};
      // 失败返回 false,不调用上述回调
      if (savedInstanceState != null) {
          mWeiboShareAPI.handleWeiboResponse(getIntent(), this);
      }
  }
 
开发者ID:ligongzai,项目名称:QianXun,代码行数:28,代码来源:WBShareActivity.java

示例2: onCreate

import com.sina.weibo.sdk.api.share.WeiboShareSDK; //导入依赖的package包/类
/**
     * @see {@link Activity#onCreate}
     */
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_scheme_page);
//       mWeiboInfo = WeiboAppManager.getInstance(this).getWeiboInfo();
        
        // 创建微博分享接口实例
        mWeiboShareAPI = WeiboShareSDK.createWeiboAPI(this, Constants.APP_KEY);
        mWeiboShareAPI.registerApp();
        
        shearMessageReceiver = new ShearMessageReceiver();
        IntentFilter filter = new IntentFilter();  
        filter.addAction(ACTION_SHEAR_RESULT);  
        registerReceiver(shearMessageReceiver, filter); 

        this.findViewById(R.id.shear_card).setOnClickListener(this);
        this.findViewById(R.id.shear_url).setOnClickListener(this);
    }
 
开发者ID:ligongzai,项目名称:QianXun,代码行数:22,代码来源:WBShareToMessageFriendActivity.java

示例3: initPlatforms

import com.sina.weibo.sdk.api.share.WeiboShareSDK; //导入依赖的package包/类
/**
 * 分享界面初始化各个分享平台的信息
 *
 * @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);
}
 
开发者ID:pinguo-sunjianfei,项目名称:Android-Application-ZJB,代码行数:27,代码来源:ShareModel.java

示例4: onCreate

import com.sina.weibo.sdk.api.share.WeiboShareSDK; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    Intent intent = getIntent();
    if(intent == null){
        finish();
        return;
    }
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        SystemBarTintManager tintManager = new SystemBarTintManager(this);
        tintManager.setStatusBarTintEnabled(true);
        tintManager.setStatusBarTintResource(R.color.app_main_theme_color);
    }
    inflater = LayoutInflater.from(this);

    mTencent = Tencent.createInstance(Globe.QQ_APP_ID, this);
    mAuthInfo = new AuthInfo(this, Globe.SINA_APP_KEY, Globe.SINA_REDIRECT_URL, null);
    mSsoHandler = new SsoHandler(this, mAuthInfo);
    mIWeiboShareAPI =  WeiboShareSDK.createWeiboAPI(this, Globe.SINA_APP_KEY);
    mIWeiboShareAPI.registerApp();
}
 
开发者ID:x251089003,项目名称:EveryXDay,代码行数:24,代码来源:ToolbarControlDetailListViewActivity.java

示例5: sendText

import com.sina.weibo.sdk.api.share.WeiboShareSDK; //导入依赖的package包/类
public void sendText(String text) throws MalformedURLException, IOException {
	// String text = getData(json, "text");
	// String image_path = getData(json, "image");
	Log.d(TAG, "app key : " + appKey);
	mWeiboShareAPI = WeiboShareSDK.createWeiboAPI(
			this.cordova.getActivity(), appKey);
	mWeiboShareAPI.registerApp(); // 将应用注册到微博客户端
	WeiboMultiMessage weiboMessage = new WeiboMultiMessage();// 初始化微博的分享消息
	if (text != null) {
		TextObject textObject = new TextObject();
		textObject.text = text;
		weiboMessage.textObject = textObject;
	}
	SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest();
	request.transaction = String.valueOf(System.currentTimeMillis());
	request.multiMessage = weiboMessage;
	mWeiboShareAPI.sendRequest(this.cordova.getActivity(), request); // 发送请求消息到微博,唤起微博分享界面
}
 
开发者ID:mrichie,项目名称:pg-weibo,代码行数:19,代码来源:QyWeibo.java

示例6: WeiboShareManager

import com.sina.weibo.sdk.api.share.WeiboShareSDK; //导入依赖的package包/类
public WeiboShareManager(Context context) {
    mContext = context;
    mSinaAppKey = ShareBlock.getInstance().getWeiboAppId();
    if (!TextUtils.isEmpty(mSinaAppKey)) {
        // 创建微博 SDK 接口实例
        mSinaAPI = WeiboShareSDK.createWeiboAPI(context, mSinaAppKey);
        mSinaAPI.registerApp();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:WeiboShareManager.java

示例7: WBShare

import com.sina.weibo.sdk.api.share.WeiboShareSDK; //导入依赖的package包/类
WBShare(Activity activity, Platform platform) {
    mActivity = activity;
    mPlatform = platform;
    mApi = WeiboShareSDK.createWeiboAPI(mActivity, platform.getAppId());
    mApi.registerApp();
    services.put(this, true);
}
 
开发者ID:czy1121,项目名称:sdk3rd,代码行数:8,代码来源:WBShare.java

示例8: onCreate

import com.sina.weibo.sdk.api.share.WeiboShareSDK; //导入依赖的package包/类
/**
    * @see {@link Activity#onCreate}
    */
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_share);
       initViews();

       // 创建微博分享接口实例
       mShareWeiboAPI = WeiboShareSDK.createWeiboAPI(this, Constants.APP_KEY);
       
       // 处理微博客户端发送过来的请求
	mShareWeiboAPI.handleWeiboRequest(getIntent(), this);
}
 
开发者ID:ligongzai,项目名称:QianXun,代码行数:16,代码来源:WBShareResponseActivity.java

示例9: onCreate

import com.sina.weibo.sdk.api.share.WeiboShareSDK; //导入依赖的package包/类
/**
 * @see {@link Activity#onCreate}
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_pay);
    
    mWeiboShareAPI = WeiboShareSDK.createWeiboAPI(this, Constants.APP_KEY);
    mWeiboShareAPI.registerApp(); 
    
    orderUri = (EditText) findViewById(R.id.get_order_uri);
    order = (EditText) findViewById(R.id.order);
    findViewById(R.id.weibo_get_order).setOnClickListener(this);
    findViewById(R.id.weibo_pay).setOnClickListener(this);
}
 
开发者ID:ligongzai,项目名称:QianXun,代码行数:17,代码来源:WBPayActivity.java

示例10: getInstance

import com.sina.weibo.sdk.api.share.WeiboShareSDK; //导入依赖的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

示例11: share

import com.sina.weibo.sdk.api.share.WeiboShareSDK; //导入依赖的package包/类
@Override
public void share(Activity activity, Bitmap shareBitmap, Bitmap thumbBitmap, int platform) {
    mWeibo = null;
    mWeibo = WeiboShareSDK.createWeiboAPI(activity, BuildConfig.SINA_APP_KEY);
    mWeibo.registerApp();
    ShareType = ShareConstant.SHARE;

    share(activity, shareBitmap);
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:10,代码来源:ShareSina.java

示例12: shareWeiboGif

import com.sina.weibo.sdk.api.share.WeiboShareSDK; //导入依赖的package包/类
private void shareWeiboGif(Activity activity, String url) {
    if (mWeibo == null) {
        mWeibo = WeiboShareSDK.createWeiboAPI(activity, BuildConfig.SINA_APP_KEY);
        mWeibo.registerApp();
    }
    ImageObject imageobj = new ImageObject();
    imageobj.imageData = Util.bmpToByteArray(GlideBitmapFactory.decodeFile(url), true);
    WeiboMessage multmess = new WeiboMessage();
    multmess.mediaObject = imageobj;
    SendMessageToWeiboRequest multRequest = new SendMessageToWeiboRequest();
    multRequest.message = multmess;
    multRequest.transaction = String.valueOf(System.currentTimeMillis());

    mWeibo.sendRequest(activity, multRequest);
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:16,代码来源:ShareSina.java

示例13: onCreate

import com.sina.weibo.sdk.api.share.WeiboShareSDK; //导入依赖的package包/类
public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    Bundle extras = getIntent().getExtras();
    int i = extras.getInt("action");
    String string = extras.getString("appkey");
    String string2 = extras.getString("redirectUrl");
    String string3 = extras.getString("permissions");
    boolean z = extras.getBoolean("isUserClient");
    if (string3 == null) {
        string3 = "";
    }
    this.d = new AuthInfo(this, string, string2, string3);
    this.c = new SsoHandler(this, this.d);
    if (i == 1) {
        if (z) {
            this.c.authorize(this);
        } else {
            this.c.authorizeWeb(this);
        }
    } else if (i == 2) {
        this.a = extras.getString("token");
        this.e = WeiboShareSDK.createWeiboAPI(this, string);
        this.e.registerApp();
        a();
    } else {
        e();
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:29,代码来源:SinaActivity.java

示例14: init

import com.sina.weibo.sdk.api.share.WeiboShareSDK; //导入依赖的package包/类
@Override
public WeiboShare init(Context context, SKShareConfig shareConfig) {
    APP_ID = shareConfig.getProperty(APP_ID_KEY);
    mWeiboShareAPI = WeiboShareSDK.createWeiboAPI(context, APP_ID);
    mWeiboShareAPI.registerApp();
    return this;
}
 
开发者ID:jhwing,项目名称:SKShare,代码行数:8,代码来源:WeiboShare.java

示例15: SinaShareImpl

import com.sina.weibo.sdk.api.share.WeiboShareSDK; //导入依赖的package包/类
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);
}
 
开发者ID:maoruibin,项目名称:ChinaShare,代码行数:13,代码来源:SinaShareImpl.java


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