第三方的QQ 的分享功能

全局的build.gradle中配置
classpath “com.mob.sdk:MobSDK:2018.0319.1724”

全局的APP的build.gradle中配置:
最上边:apply plugin: ‘com.mob.sdk’
下边:MobSDK {
appKey “d580ad56b4b5”
appSecret “7fcae59a62342e7e2759e9e397c82bdd”

ShareSDK {
    //平台配置信息
    devInfo {
        SinaWeibo {
            appKey "568898243"
            appSecret "38a4f8204cc784f81f9f0daaf31e02e3"
            callbackUri "http://www.sharesdk.cn"
            shareByAppClient false
        }
        Wechat {
            appId "wx4868b35061f87885"
            appSecret "64020361b8ec4c99936c0e3999a9f249"
        }
        QQ {
            appId "100371282"
            appKey "aed9b0303e3ed1e27bae87c33761161d"
            shareByAppClient true
        }
        Facebook {
            appKey "1412473428822331"
            appSecret "a42f4f3f867dc947b9ed6020c2e93558"
            callbackUri "https://mob.com"
        }
    }
}

}
是这样配置
apply plugin: ‘com.android.application’
apply plugin: ‘com.mob.sdk’
android {
compileSdkVersion 26
defaultConfig {
applicationId “liyuanqi.bwie.com.denglufenxiang”
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName “1.0”
testInstrumentationRunner “android.support.test.runner.AndroidJUnitRunner”
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro
}
}
}

MobSDK {
appKey “d580ad56b4b5”
appSecret “7fcae59a62342e7e2759e9e397c82bdd”

ShareSDK {
    //平台配置信息
    devInfo {
        SinaWeibo {
            appKey "568898243"
            appSecret "38a4f8204cc784f81f9f0daaf31e02e3"
            callbackUri "http://www.sharesdk.cn"
            shareByAppClient false
        }
        Wechat {
            appId "wx4868b35061f87885"
            appSecret "64020361b8ec4c99936c0e3999a9f249"
        }
        QQ {
            appId "100371282"
            appKey "aed9b0303e3ed1e27bae87c33761161d"
            shareByAppClient true
        }
        Facebook {
            appKey "1412473428822331"
            appSecret "a42f4f3f867dc947b9ed6020c2e93558"
            callbackUri "https://mob.com"
        }
    }
}

}

dependencies {
implementation fileTree(dir: ‘libs’, include: [’*.jar’])
implementation ‘com.android.support:appcompat-v7:26.1.0’
implementation ‘com.android.support.constraint:constraint-layout:1.1.3’
testImplementation ‘junit:junit:4.12’
androidTestImplementation ‘com.android.support.test?1.0.2’
androidTestImplementation ‘com.android.support.test.espresso:espresso-core:3.0.2’
}

分享的代码:
OnekeyShare oks = new OnekeyShare();
//关闭sso授权
oks.disableSSOWhenAuthorize();

    // title标题,微信、QQ和QQ空间等平台使用
    oks.setTitle(getString(R.string.share));
    // titleUrl QQ和QQ空间跳转链接
    oks.setTitleUrl("http://sharesdk.cn");
    // text是分享文本,所有平台都需要这个字段
    oks.setText("我是分享文本");
    // imagePath是图片的本地路径,Linked-In以外的平台都支持此参数
    oks.setImagePath("/sdcard/test.jpg");//确保SDcard下面存在此张图片
    // url在微信、微博,Facebook等平台中使用
    oks.setUrl("http://sharesdk.cn");
    // comment是我对这条分享的评论,仅在人人网使用
    oks.setComment("我是测试评论文本");
    // 启动分享GUI
    oks.show(this);
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值