Login via Twitter
Add dependencies
- Android
- iOS
- Unity
- Unreal
Add the following code in build.gradle on the app-level, and replace $msdk_version with the actual MSDK version.
dependencies {
implementation "com.garena.sdk.android:login-twitter:$msdk_version"
}
Configuration
- Android
- iOS
- Unity
- Unreal
Configure 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>
Add the following to the info.plist:
- Add twitter and twitterauth to LSApplicationQueriesSchemes
- Add TwitterSecret and TwitterKey
- Add twitter-(TwitterKey) to URL Schemes
Add MapKit, CoreMedia, CoreLocation, Accounts frameworks into your project
<key>TwitterKey</key>
<string>YOUR_TWITTER_KEY</string>
<key>TwitterSecret</key>
<string>YOUR_TWITTER_SECRET</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>twitterkit-YOUR_TWITTER_KEY</string>
</array>
</dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>twitter</string>
<string>twitterauth</string>
</array>
Usage
- Android
- iOS
- Unity
- Unreal
AccountManager accountManager = new AccountManager(activity);
accountManager.login(PlatformType.TWITTER, onLoginListener);
[MSDKLoginManager loginWithPlatform:MSDKePlatformTwitter completion:^(MSDKLoginRet *loginRet) {
// handle login result
}];
GMSDKHandler.LoginClient.Login(twitterLoginParams, OnLoginCallback);
UMsdkLogin::LoginWithParams(TwitterLoginParams);