跳到主要内容

Twitter登录

添加依赖

在应用级别的 build.gradle 中添加以下代码,并将 $msdk_version 替换为实际的 MSDK 版本。

dependencies {
implementation "com.garena.sdk.android:login-twitter:$msdk_version"
}

配置

配置 AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

...

<application ...>

<meta-data
android:name="com.garena.sdk.twitter.key"
android:value="[twitter_key]" />

<meta-data
android:name="com.garena.sdk.twitter.secret"
android:value="[twitter_secret]" />
....
</application>

</manifest>

使用方法

accountManager.login(PlatformType.TWITTER, onLoginListener);