Skip to content

QQHelper for androidx,QQ开放平台功能封装,包含QQ分享,QQ授权登录

Notifications You must be signed in to change notification settings

kongqw/QQHelper

Repository files navigation

QQ开放平台功能封装

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包。

Gradle 配置 QQ_APP_ID

android {
    ……
    defaultConfig {
        ……
        manifestPlaceholders = [
                QQ_APP_ID    : '你申请的appid'
        ]
        ……
    }
    ……
}

初始化(非必要)

QQHelper.init(true, 是否已经授权)

关系到上架后的隐私问题,详见 Tencent.setIsPermissionGranted

QQ分享

分享图文链接

QQHelper.getInstance().shareImageAndText(`activity`, `标题`, `摘要`, `链接`, `缩略图`, `监听接口`)

分享图片

QQHelper.getInstance().shareLocalImage(`activity`, `本地图片地址`, `监听接口`)

分享到QQ空间

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()
}

About

QQHelper for androidx,QQ开放平台功能封装,包含QQ分享,QQ授权登录

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages