05/15/2024 15:19:45

QQ Channel Description

I. Android Project Configuration

I. Android Project Configuration

1.1 Permission Configuration

In AndroidManifest.xml, add permissions

 <uses-permission android:name="android.permission.INTERNET" />
 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
 <uses-permission android: name="android.permission.WRITE_EXTERNAL_STORAGE" />

1.2 Entry Activity Configuration

In the application node, add the following activity configuration

<activity
    android: name="com.tencent.connect.common.AssistActivity"
    android: configChanges="orientation|keyboardHidden"
    android: screenOrientation="behind"
    android: theme="@android: style/Theme.Translucent.NoTitleBar" />

<activity
    android: name="com.tencent.tauth.AuthActivity"
    android: launchMode="singleTask"
    android: noHistory="true" >
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="tencent{YOUR_QQ_APP_ID}" />
        </intent-filter>
</activity>

[info] It is needed to replace {YOUR_QQ_APP_ID} with the app's own APP ID

1.3 App ID Configuration

In the project's assets/MSDKConfig.ini file, add the following configurations

[QQ channel configuration ]
QQ_APP_ID={YOUR_QQ_APP_ID}

[info] It is needed to replace {YOUR_QQ_APP_ID} with the app's own APP ID

II. iOS Project Configuration

II. iOS Project Configuration

2.1 MSDKConfig Configuration file

In the project, find MSDKAppSetting.bundle/MSDKConfig.ini file, and add the following configuration

QQ_APP_ID = {YOUR_QQ_APP_ID}

[info] Replace {YOUR_QQ_APP_ID} with APP_ID applied for by the app

2.2 Xcode Project Configuration Fsile info.plist

Find or create the following nodes:

 <key>CFBundleURLTypes</key>
     <array>
     <dict>
         <key>CFBundleURLSchemes</key>
         <array>
             <string>tencent{your qq app id}</string>
         </array>
     </dict>
 </array>
 <key>LSApplicationQueriesSchemes</key>
 <array>
     <string>mqq</string>
     <string>mqqapi</string>
     <string>mqqwpa</string>
     <string>mqqbrowser</string>
     <string>mttbrowser</string>
     <string>mqqOpensdkSSoLogin</string>
     <string>mqqopensdkapiV2</string>
     <string>mqqopensdkapiV3</string>
     <string>mqqopensdkapiV4</string>
     <string>wtloginmqq2</string>
     <string>mqzone</string>
     <string>mqzoneopensdk</string>
     <string>mqzoneopensdkapi</string>
     <string>mqzoneopensdkapi19</string>
     <string>mqzoneopensdkapiV2</string>
     <string>mqqapiwallet</string>
     <string>mqqopensdkfriend</string>
     <string>mqqopensdkavatar</string>
     <string>mqqopensdkminiapp</string>
     <string>mqqopensdkdataline</string>
     <string>mqqgamebindinggroup</string>
     <string>mqqopensdkgrouptribeshare</string>
     <string>tencentapi.qq.reqContent</string>
     <string>tencentapi.qzone.reqContent</string>
     <string>mqqthirdappgroup</string>
     <string>mqqopensdklaunchminiapp</string>
     <string>mqqopensdkproxylogin</string>
     <string>mqqopensdknopasteboard</string>
     <string>mqqopensdkcheckauth</string>
     <string>mqqguild</string>
     <string>mqqopensdknopasteboardios16</string>
 </array>
 <key>NSAppTransportSecurity</key>
     <dict>
     <key>NSAllowsArbitraryLoads</key>
     <true/>
 </dict>

Where, {your qq app id} needs to be modified into QQ AppID applied for by the game. In addition, it is recommended that the above LSApplicationQueriesSchemes be configured within the top 50. For details, please refer to iOS Developer Documentation

2.3 Unity XUPoter's xx.projmods File's Configuration

When Unity exports XCode project, it needs to configure projmods file, so as to make the exported XCode project get the configuration of 3.2

{
    "group": "MSDKQQ", 
    "libs": [],
    "frameworks": [],
    "files": [],
    "folders": [],
    "excludes": [],
    "headerpaths":[],
    "build_settings": 
    {}, 
    "system_capabilities": {},
    "Info.plist":{
        "LSApplicationQueriesSchemes":
        [
            "mqq",
            "mqqapi",
            "mqqwpa",
            "mqqbrowser",
            "mttbrowser",
            "mqqOpensdkSSoLogin",
            "mqqopensdkapiV2",
            "mqqopensdkapiV3",
            "mqqopensdkapiV4",
            "wtloginmqq2",
            "mqzone",
            "mqzoneopensdk",
            "mqzoneopensdkapi",
            "mqzoneopensdkapi19",
            "mqzoneopensdkapiV2",
            "mqqapiwallet",
            "mqqopensdkfriend",
            "mqqopensdkdataline",
            "mqqgamebindinggroup",
            "mqqopensdkgrouptribeshare",
            "tencentapi.qq.reqContent",
            "tencentapi.qzone.reqContent",
        ],
        "CFBundleURLTypes" :
        [
            {
                "CFBundleTypeRole":"Editor",
                "CFBundleURLSchemes":["tencent{QQ_APPID}"]
            }
        ]
    }, 
}

Where, {QQ_APPID} needs to be modified into QQ AppID applied for by the game

Please refer to the description of Universal Link for details

III. Function Description

III. Function Description

QQ platform side's logic: When the QQ client login is not installed, iOS will launch the QQ Web login page and Android will launch the QQ download page, without additional processing from the game.For details, please contact qqconnecthelper (QQ interconnection and login consultation).

3.1 Login Function

Use QQ to authorize login. For details, please refer to Login Module

When calling MSDKLogin.Login, you need to pass in the permissions; Passing in "all" means that you have all the permissions of the platform you have applied for.

The known permission list of WeChat iOS/Android is shown as follows (the official documentation has no specific permission description):

The known permission list is shown as follows:

Permission Description
get_user_info Get the user's information
get_app_friends Get QQ friends' relationships
get_simple_userinfo Get QQ's basic information
get_vip_info Get your VIP information
get_vip_rich_info Get QQ member's detailed information
get_friends_info Get the QQ in-game friend list
add_share Post share to QZone

Use QQ QR code scanning-based login

Judge whether QQ App is installed. If QQ APP is not installed, you can use the QR code login function, invoke MSDKLogin.Login to add QRCode configuration in the extraJson and then open the QR code login UI. Demo code

C#
C++
MSDKLogin.Login (channel, "", "", "{\"QRCode\":true}");
GCloud::MSDK::MSDKLogin::Login(channel, "", "", "{\"QRCode\":true}");

3.2 Friend Function

Send information to QQ friends, share images and videos to Qzone. For details, please refer to Friend Module

3.2.1 Sending function support type

No. Function Required Field
1 Send text - pop-up box type, desc (description)
2 Send link - pop-up box type, link
3 Send image - pop-up box type, imagePath (image address)
4 Send music - pop-up box type, link
5 App invitation - pop-up box type
6 App invitation - silence user (friend openid), link, imagePath (image address)
7 Send ARK message user (friend openid), link, imagePath (image address)
8 Send miniApp message type, desc (summary description; if this field is not filled, some models may report parameter error), extraJson (miniApp parameter)
9 Launch miniApp (supported since version 5.30.000) type, extraJson (miniApp parameter)

[warning] Precaution 1.The text-sending function, which is only supported by iOS but is not supported by Android.
2.The Silence invitation of QQ requires the user to pay attention to QQ mobile game service account. Invitation is also sent through this service account.
3.The image address 'imagePath' can be the path of a network image or a local image. The network image will be downloaded and saved locally before being sent/shared.
4.extraJson parameters for miniApp sharing include mini_appid, mini_path, mini_webpage_url, and mini_program_type.
5.Application invitation-silence. Add game_tag in the extended field to facilitate the platform sharing type statistics,

   reqInfo.ExtraJson = "{\"game_tag\":\"MSDKGameTag-Unity\"}";

6.Extended parameters; add extended parameters such as 'game_message_ext' and 'game_tag_name' to extraJson, and send app invitations, images and Ark messages to support the function of the extended parameters

   reqInfo.ExtraJson = "{\"game_message_ext\":\"MSDKGameTag-Unity\",\"game_tag_name\":\"MSDKGameTag-Unity\"}";

3.2.2 share function support type

No. Function Required Field
1 Share text - pop-up box type, desc (description)
2 Share link - pop-up box type, link
3 Share image - pop-up box type, imagePath (image address)
4 Share video - pop-up box type, mediaPath ( multimedia address)
5 Send music - pop-up box type, link
6 Send miniApp message type, desc (summary description; if this field is not filled, some models may report parameter error), extraJson (miniApp parameter)

[warning] Precaution 1.Other send/share types are not supported
2.The video sharing function is recommended to use the local video address. QQ officially limits the maximum video size to 50M. It is recommended that the game dynamically adjust the size according to the model. MSDK can only judge whether the video address is empty and does not check its validity. If the address is invalid, QQ will first launch the page indicated by the address and then return back to the original site and inform the caller that the user has cancelled the sharing
3.The music-sharing function is only supported by IOS and is not supported by Android
4.The image address 'imagePath' can be the path of a network image or a local image. The network image will be downloaded and saved locally before being sent/shared.
5.ExtraJson parameters for MiniApp sharing include mini_appid, mini_path, mini_webpage_url, mini_program_type.
6.Extended parameters; add extended parameters such as 'game_message_ext' and 'game_tag_name' to extraJson, and send app invitations, images and Ark messages to support the function of the extended parameters

   reqInfo.ExtraJson = "{\"game_message_ext\":\"MSDKGameTag-Unity\",\"game_tag_name\":\"MSDKGameTag-Unity\"}";

3.2.3 add friend

No. Function Required Field
1 add friend user(friend MSDK openID)

[warning] Precaution

  1. The friend-adding function has a different logic in Android and iOS: Android QQ SDK has no callback. After MSDK calls QQ, it will return the "Success" callback directly. The "Success" callback can only indicate the success of calling QQ SDK but does not mean that the result of adding a friend must be successful. iOS QQ SDK has a unified QQ return callback processing mode. After MSDK calls QQ and returns from QQ, it can get the return callback and pass it to the game.
  2. The inconsistency of the callbacks for adding friends at both systems originates from the design of the QQ platform. In fact, whether a friend is added successfully depends on whether the other party agrees with the request of adding him or her as a friend, so the game does not need to care about the friend-adding callbacks, and the callback cannot be used as a relevant proof.

3.3 Group Functions

QQ group Functions include: create a group, join the existing group, get group state, get group relations, unbind a group, bind a group, remind the union president to build a group, and get the list of groups created by the union president

For details, please refer to Group module

3.4 QQ launches the game

The game is launched from QQ. Currently, there are the following two forms of launch

  • The user clicks on the invitation message to launch the game

  • The game is launched from the Game Center

For both launches, MSDK can respond to them and transparently pass parameters from QQ to the params field of extraJson, and the game can get the passed data from the field.

The format of the passed data is as follows:

{
    "extraJson":"{\"params\":\"{\\\"gamedata\\\":\\\"MSDK\\\",\\\"atoken\\\":\\\"9436F9E54343D839C2DFDBAF65672D31\\\",\\\"fling_action_key\\\":2,\\\"openid\\\":\\\"92996552B2C33EA7E5412F19C0EBD643\\\",\\\"preAct\\\":\\\"QQBrowserActivity\\\",\\\"ptoken\\\":\\\"D947F9FBC24F11A542892B25ADD532F9\\\",\\\"leftViewText\\\":\\\"return\\\",\\\"fling_code_key\\\":204041314,\\\"platformdata\\\":\\\"\\\",\\\"preAct_time\\\":1559283567140,\\\"launchfrom\\\":\\\"sq_gamecenter\\\",\\\"current_uin\\\":\\\"92996552B2C33EA7E5412F19C0EBD643\\\",\\\"platform\\\":\\\"qq_m\\\"}\",\"game_data\":\"MSDK\"}",
    "methodNameID":119,
    "retCode":1013,
    "retMsg":"Need different account alert",
    "ret":-1,
    "msg":""
}

Note: The names and contents of the corresponding fields in params in extraJson are all passed by QQ. The game_data field in extraJson carries the copy of the content filled when the game player sends an invitation to friends. If the game is launched from the Game Center, the field will be parsed accordingly.

game_data field's transparent transmission

var reqInfo = new MSDKFriendReqInfo ();
reqInfo.Link = "http://www.qq.com";
reqInfo.ExtraJson = "{\"game_data\":\"iOS Game Data 测试游戏数据\"}"; 
reqInfo.ExtraJson = "{\"game_data\": \"iOS Game Data (test game data)\"}";

Scenario: The game launches QQ-app through the invitation message delivery interface to send a message to the player's QQ friends. When the player's QQ friends click on the message, the link jumps back to the game

The game_data field added to ExtraJson in MSDKFriendReqInfo when the message is sent will be transparently transmitted to the game when the message is clicked to start the game. The returned data is in game_data in ExtraJson of MSDKBaseRet, where params is all the data returned by QQ callback.

{
  "methodNameID": 0,
  "channelID": 2,
  "channel": "QQ",
  "seqID": "11-2B4C94EE-0CC8-4433-A313-1678F57272FA-1585292132-17",
  "extraJson": {
    "params": {
      "openid": "290F941C5F87AA8BB2B77E57565A724F",
      "atoken": "9554C3570DDEBA11F3A90DC9FDDB4A75",
      "platform": "qq_m",
      "platformdata": "",
      "gamedata": "iOS%20Game%20Data%20%E6%88%91%E6%98%AF%E6%B5%8B%E8%AF%95--%3D%3DhelloMSDK",
      "huashan_com_sid": "biz_src_jc_ark"
    },
    "game_data": "iOS Game Data (test game data)"
  }
}
IV. Update interconnected opensdk3.3.9 to support QQ miniApp parameter transfer function

IV. Update interconnected opensdk3.3.9 to support QQ miniApp parameter transfer function

4.1 How does the business side carry miniApp?

The parameter transfer mode of the original QQ miniApp
info.extraJson = "{\"mini_appid\":\"1109787314\",\"mini_path\":\"pages/component/pages/launchApp813/launchApp813\",\"mini_webpage_url\":\"www.qq.com\",\"mini_program_type\":3}";

Add 'get' parameter behind mini_path after carrying the team information
info.extraJson = "{\"mini_appid\":\"1109787314\",\"mini_path\":\"pages/component/pages/launchApp813/launchApp813?key1=val2&key3=val4\",\"mini_webpage_url\":\"www.qq.com\",\"mini_program_type\":3}";

4.2 How does the business side receive the transferred parameters?

When click on the message starts the game, the parameters will be transparently transmitted to the game. The returned data is in game_data in ExtraJson of MSDKBaseRet of the Wakeup callback function, and the format is a JSON string. At the same time, the attachment has the ‘channel’ field to distinguish channels

{
  "methodNameID": 0,
  "channelID": 2,
  "channel": "QQ",
  "seqID": "11-2B4C94EE-0CC8-4433-A313-1678F57272FA-1585292132-17",
  "extraJson": {
    "channel": "QQ",
    "game_data": "{\key1\":\"val2\", \key3\":\"val3\"}"
  }
}

4.3 Configuration changes

QQ SDK needs to provide fileProvider, so MSDK QQ adds the following item in AndroidManifest.xml

 <provider android:authorities="${applicationId}.QQSDKFileProvider"
           android:name="android.support.v4.content.FileProvider"
           android:exported="false"
           android:grantUriPermissions="true" >
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS"
                       android:resource="@xml/file_paths"/>
</provider>

And it adds file_paths.xml in the res/xml directory

<?xml version="1.0" encoding="utf-8"?>
<paths>
    <external-files-path name="opensdk_external" path="Images/tmp"/>
    <root-path name="opensdk_root" path=""/>
</paths>

When the project team is upgraded, if the Internal build mode is used, the $(applicationId) macro will have a compilation error. At this time, be sure to replace the macro with the package name

Because fileProvider affects image sharing, it is recommended that the project team must check the sharing of all images when accessing it, so as to ensure that the functions are available after the upgrade

4.4 Precautions

  • When QQ miniApp launches App, if the App carries no parameter, no WakeupEvent callback will be generated



Copyright © 2024 MSDK.
All rights reserved.

results matching ""

    No results matching ""