To get a Git project into your build:
Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.kongqw:QQHelper:1.3.1'
}
自行下载jar包,引入到项目中,Library不再将打入jar包。
android {
……
defaultConfig {
……
manifestPlaceholders = [
QQ_APP_ID : '你申请的appid'
]
……
}
……
}
QQHelper.init(true, 是否已经授权)
关系到上架后的隐私问题,详见 Tencent.setIsPermissionGranted
QQHelper.getInstance().shareImageAndText(`activity`, `标题`, `摘要`, `链接`, `缩略图`, `监听接口`)
QQHelper.getInstance().shareLocalImage(`activity`, `本地图片地址`, `监听接口`)
QQHelper.getInstance().shareToQZone(`activity`, `标题`, `摘要`, `链接`, `缩略图`, `监听接口`)
自定义Bundle
详见 API调用说明
QQHelper.getInstance().customShare(`activity`, `自定义Bundle`, `监听接口`)
interface OnQQShareListener {
fun onQQShareStart()
fun onQQShareComplete(p0: Any?)
fun onQQShareCancel()
fun onQQShareError(errorCode: Int?, errorMessage: String?, errorDetail: String?)
fun onNotInstall()
}
QQHelper.getInstance().authLogin(`Activity Context`, `监听接口`)
interface OnQQAuthLoginListener {
fun onQQAuthLoginStart()
fun onQQAuthLoginSuccess(qqLoginInfo: QQLoginInfo?)
fun onQQAuthLoginCancel()
fun onQQAuthLoginFail()
fun onQQAuthLoginError(errorCode: Int?, errorMessage: String?, errorDetail: String?)
fun onNotInstall()
}