本文整理汇总了Java中com.sina.weibo.sdk.api.share.WeiboShareSDK.createWeiboAPI方法的典型用法代码示例。如果您正苦于以下问题:Java WeiboShareSDK.createWeiboAPI方法的具体用法?Java WeiboShareSDK.createWeiboAPI怎么用?Java WeiboShareSDK.createWeiboAPI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sina.weibo.sdk.api.share.WeiboShareSDK
的用法示例。
在下文中一共展示了WeiboShareSDK.createWeiboAPI方法的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);
}
}
示例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);
}
示例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);
}
示例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();
}
示例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); // 发送请求消息到微博,唤起微博分享界面
}
示例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();
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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();
}
}
示例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;
}
示例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);
}