BiliShare
Introduction: An android socializing SDK that supports to share text/image/web page/video/audio to qq/qzone/wechat/moment/sina platforms.
Tags:
支持分享到微博、QQ 聊天、QQ 空间、微信聊天、微信朋友圈,系统分享等。
QQ 交流群:397462257
预览
- 下载 demo bilibili
screenshot
使用姿势
配置
- 在 build.gradle 里添加依赖. "biliShare"是核心库(必需),"biliShare-util"是分享的选择器(非必需),如上截图所示.
allprojects {
repositories {
jcenter()
maven { url "https://dl.bintray.com/thelasterstar/maven/"}
}
}
dependencies {
compile 'com.jungly.socialize:biliShare:0.1.0701' //必需
compile 'com.jungly.socialize:biliShare-util:0.1.0701@aar' //非必需
}
- 配置 QQ 分享,在 AndroidManifest 文件里添加如下配置,注意在 scheme 里添加你的 appId。
<activity
android:name="com.tencent.tauth.AuthActivity"
android:launchMode="singleTask"
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tencent 你的 AppId" />
</intent-filter>
</activity>
- 配置微信分享,在{root package}/wxapi/下添加 WXEntryActivity,并且配置到 AndroidManifest 文件里。
public class WXEntryActivity extends BaseWXEntryActivity {
@Override
protected String getAppId() {
return .....;
}
}
<activity
android:name=".wxapi.WXEntryActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:exported="true"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
使用
示例代码
BiliShareConfiguration configuration = new BiliShareConfiguration.Builder(context) .sina(appKey, redirectUrl, scope) //配置新浪 .qq(appId) //配置 qq .weixin(appId) //配置微信 .imageDownloader(new ShareFrescoImageDownloader()) //图片下载器 .build(); //global client 全局共用,也可以用 BiliShare.get(name)获取一个特定的 client,以便业务隔离。 BiliShare shareClient = BiliShare.global(); shareClient.config(configuration); //config 只需要配置一次 shareClient.share(context, socializeMedia, shareParam, shareListener);
具体参考/sample/src/main/java/com/bilibili/socialize/sample/MainActivity.class
版本
版本 | 时间 | 变更 |
---|---|---|
0.1.0701 | 2017-05-05 | 1,升级微博 SDK 至 2.0.3; 2,升级 QQ SDK 至 5788; 3,升级微信 SDK 至 1.1.6; 4,去除 BiliShare 的 onActivityResult()。 5,解决若干 bug。 |
0.1.06 | 2017-04-24 | 支持多 BiliShare 实例,方便多业务隔离 |
...... |
License
Copyright 2015-2017 Bilibili
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.