MSSDK

SDK 文档


SDK Integration(no UI)

<p>[TOC]</p> <h1>Version</h1> <table> <thead> <tr> <th>Version number</th> <th>Time</th> <th>Modify content</th> <th>Responsible person</th> <th>Remarks</th> </tr> </thead> <tbody> <tr> <td>V1.0</td> <td>2019/07/30</td> <td>Separation from the integration documentation</td> <td>wesley.zhong</td> <td>None</td> </tr> </tbody> </table> <h3>1 Overview</h3> <ul> <li>MSSDK (Micro Services SDK) is a new standardized SDK provided by the 2019 technology middle platform.</li> <li>Support Android 4.1 and above, support Android Studio development tools.</li> <li>This article mainly describes the Android MSSDK no UI version integration tutorial, API call details please refer to 《Android MSSDK API Documentation》</li> <li>The matter is ready to be integrated with the SDK. Please refer to the MSSDK integration document.</li> <li>Initialize the SDK, APP lifecycle listener call, please refer to the MSSDK integration document</li> </ul> <p><strong> Special attention: If the game developers are about to access is the type of online games (leisure games can be ignored), in order to login and pay security, the server access related interface is required. Specific access documents can be viewed <a href="https://www.showdoc.cc/mssdk?page_id=2647897962757260">MSSDK server documents</a></strong></p> <h3>2 Function access</h3> <ul> <li>The MSSDK functions can be called only if the SDK is successfully initialized.</li> <li>MSSDK no UI version provides user functionality.</li> </ul> <h4>2.1 Access User (no UI version)</h4> <ul> <li>MSSDK user function provides the ability to log in without UI version, bind mobile phone, real name authentication, etc. It is convenient for the game to enter more related functions to achieve more custom elements;</li> <li>The current version provides automatic login, visitor login, mobile phone number + verification code login, username + password login;</li> <li>The current version provides functions such as binding mobile phone number, changing mobile phone number, setting password, real name authentication, obtaining user agreement and privacy policy.</li> <li>The current version provides the account information bound to the phone number and checks whether the verification code is correct.</li> </ul> <h5>2.1.1 Automatic login</h5> <ul> <li>User scene: The user logs in successfully without triggering the logout. When the game is started again, there is no need to verify and enter the game directly.</li> <li>SDK logic: The game calls the MSSDK automatic login interface, and the MSSDK uses the last login information to automatically log in.</li> <li>Example: <pre><code class="language-java"> MSLDSDK.action(activity, AccountPath.ROUTE_ACCOUNT_DIRECT_AUTO_LOGIN, new HashMap&lt;&gt;(),                 New MSLDCallback&lt;MSLDAccount&gt;() {</code></pre></li> </ul> <p>                    @Override                     Public void onSuccess(String msg, MSLDAccount data) {                      }</p> <p>                    @Override                     Public void onFail(int code, String msg, Object errorData) {                     }                 });</p> <pre><code> ##### 2.1.2 Visitor Login - Create a guest account for the user and enter the gaming experience without any verification. - Call example: ```java MSLDSDK.action(activity, AccountPath.ROUTE_ACCOUNT_DIRECT_GUEST_LOGIN, new HashMap&lt;&gt;(),                 New MSLDCallback&lt;MSLDAccount&gt;() {                     @Override                     Public void onSuccess(String msg, MSLDAccount data) {                      }                     @Override                     Public void onFail(int code, String msg, Object errorData) {                     }                 });</code></pre> <h5>2.1.3 Username + Password Login</h5> <ul> <li>After the user registers and sets the password successfully, the user can log in by username + password.</li> <li>Quick account login is also a username + password login</li> <li>Call example:</li> </ul> <pre><code class="language-java">MSLDSDK.action(activity, AccountPath.ROUTE_ACCOUNT_DIRECT_USERNAME_LOGIN,                 New HashMap() {                     {                         Put(AccountParam.KEY_USER_NAME, username);                         Put(AccountParam.KEY_PASSWORD, pwd);                     }                 },                 New MSLDCallback&lt;MSLDAccount&gt;() {                     @Override                     Public void onSuccess(String msg, MSLDAccount data) {                      }                     @Override                     Public void onFail(int code, String msg, Object errorData) {                     }                 }); </code></pre> <h5>2.1.4 Mobile number + SMS verification code login</h5> <ul> <li>After the user registers with the mobile phone number and successfully sets the password, he can log in by phone number + password.</li> <li>Call example:</li> </ul> <pre><code class="language-java">MSLDSDK.action(activity, AccountPath.ROUTE_ACCOUNT_DIRECT_PHONE_LOGIN,                 New HashMap() {                     {                         Put(AccountParam.KEY_PHONE_NUMBER, phoneNumber);                         Put(AccountParam.KEY_SMS_VERIFICATION_CODE, code);                     }                 },                 New MSLDCallback&lt;MSLDAccount&gt;() {                     @Override                     Public void onSuccess(String msg, MSLDAccount data) {                      }                     @Override                     Public void onFail(int code, String msg, Object errorData) {                     }                 });</code></pre> <h5>2.1.5 Wechat Login</h5> <ul> <li>Users login via WeChat account without registration</li> <li>WeChat parameters and configuration, please see 《MSSDK Integration Document》 4.3.2 WeChat Sharing</li> <li>Call example:</li> </ul> <pre><code class="language-java">MSLDSDK.action(activity, AccountPath.ROUTE_ACCOUNT_DIRECT_WECHAT_LOGIN, new HashMap&lt;&gt;(),                 New MSLDCallback&lt;MSLDAccount&gt;() {                     @Override                     Public void onSuccess(String msg, MSLDAccount data) {                      }                     @Override                     Public void onFail(int code, String msg, Object errorData) {                     }                 });</code></pre> <h5>2.1.6 QQ Login</h5> <ul> <li>Users login through QQ account without registration</li> <li>QQ parameters and configuration, please see 《MSSDK Integration Document》 4.3.1 QQ Sharing</li> <li>Call example:</li> </ul> <pre><code class="language-java">MSLDSDK.action(activity, AccountPath.ROUTE_ACCOUNT_DIRECT_QQ_LOGIN, new HashMap&lt;&gt;(),                 New MSLDCallback&lt;MSLDAccount&gt;() {                     @Override                     Public void onSuccess(String msg, MSLDAccount data) {                      }                     @Override                     Public void onFail(int code, String msg, Object errorData) {                     }                 });</code></pre> <h5>2.1.7 Logout</h5> <ul> <li>After logging out, the SDK will clear the login information of this time, and the account that is logged out cannot be automatically logged in next time.</li> <li>Call example:</li> </ul> <pre><code class="language-java">MSLDSDK.action(activity, AccountPath.ROUTE_ACCOUNT_DIRECT_LOGOUT, new HashMap&lt;&gt;(), new                 MSLDCallback() {                     @Override                     Public void onSuccess(String msg, Object data) {                      }                     @Override                     Public void onFail(int code, String msg, Object errorData) {                     }                 });</code></pre> <h5>2.1.8 Get SMS Verification Code</h5> <ul> <li>When the player performs &quot;Mobile number + verification code registration&quot;, &quot;Bind mobile phone number&quot;, &quot;Change mobile phone number&quot;, you need to obtain the SMS verification code of the mobile phone in advance.</li> <li>Call example:</li> </ul> <pre><code class="language-java">MSLDSDK.action(activity, AccountPath.ROUTE_ACCOUNT_DIRECT_GET_VERIFY_CODE,                New HashMap() {                     {                         Put(AccountParam.KEY_PHONE_NUMBER, phoneNumber);                     }                 },                 New MSLDCallback() {                     @Override                     Public void onSuccess(String msg, Object data) {                      }                     @Override                     Public void onFail(int code, String msg, Object errorData) {                     }                 });</code></pre> <ul> <li>Verification code usage scenario description</li> </ul> <table> <thead> <tr> <th>Verification code usage scenario</th> </tr> </thead> <tbody> <tr> <td>Mobile number + verification code login</td> </tr> <tr> <td>Bind mobile phone number</td> </tr> <tr> <td>Reset password</td> </tr> <tr> <td>Change phone number</td> </tr> <tr> <td>Check if the verification code is correct</td> </tr> </tbody> </table> <h5>2.1.9 Check if the verification code is correct</h5> <ul> <li>Check if the obtained SMS verification code is correct.</li> <li>Call example:</li> </ul> <pre><code class="language-java">MSLDSDK.action(activity, AccountPath.ROUTE_ACCOUNT_DIRECT_CHECK_VERIFY_CODE,                New HashMap() {                     {                         Put(AccountParam.KEY_PHONE_NUMBER, phoneNumber);                         Put(AccountParam.KEY_SMS_VERIFICATION_CODE, code);                     }                 },                 New MSLDCallback() {                     @Override                     Public void onSuccess(String msg, Object data) {                      }                     @Override                     Public void onFail(int code, String msg, Object errorData) {                     }                 });</code></pre> <h5>2.1.10 Querying the account information bound to the mobile phone number</h5> <ul> <li>There are generally 3 situations that need to be used:</li> <li>1 Before the user binds, check whether the phone number has been bound by another account. If it is, then one of them is triggered.</li> <li>2 Before replacing the mobile phone number, check if the mobile phone number has been bound. If it is, you should not continue to operate, and the direct prompt to replace the mobile phone number fails.</li> <li>3 Before resetting the password, check if the phone number has the current business account. If not, the password should not be allowed to be reset.</li> </ul> <pre><code class="language-java">MSLDSDK.action(activity, AccountPath.ROUTE_ACCOUNT_DIRECT_QUERY_PHONE_BIND_ACCOUNT,                New HashMap() {                     {                         Put(AccountParam.KEY_PHONE_NUMBER, phoneNumber);                     }                 },                 New MSLDCallback() {                     @Override                     Public void onSuccess(String msg, Object data) {                      }                     @Override                     Public void onFail(int code, String msg, Object errorData) {                     }                 });</code></pre> <h5>2.1.11 Binding mobile phone number</h5> <ul> <li>After the visitor logs in, obtain the verification code of the bound mobile phone number and use it to complete the binding of the account number and the mobile phone number.</li> </ul> <pre><code class="language-java">MSLDSDK.action(activity, AccountPath.ROUTE_ACCOUNT_DIRECT_BIND_PHONE,                New HashMap() {                     {                         Put(AccountParam.KEY_PHONE_NUMBER, phoneNumber);                         Put(AccountParam.KEY_SMS_VERIFICATION_CODE, code);                     }                 },                 New MSLDCallback() {                     @Override                     Public void onSuccess(String msg, Object data) {                      }                     @Override                     Public void onFail(int code, String msg, Object errorData) {                     }                 });</code></pre> <h5>2.1.12 Change the phone number</h5> <ul> <li>After successful login, change phone binding, you need to enter the old mobile phone number and verification code, as well as the new mobile phone number and verification code;</li> </ul> <pre><code class="language-java">MSLDSDK.action(activity, AccountPath.ROUTE_ACCOUNT_DIRECT_CHANGE_BIND_PHONE,                New HashMap() {                     {                         Put(AccountParam.KEY_PHONE_OLD, phoneold);                         Put(AccountParam.KEY_SMS_VERIFICATION_CODE_OLD, oldcode);                         Put(AccountParam.KEY_PHONE_NEW, phoneNew);                         Put(AccountParam.KEY_SMS_VERIFICATION_CODE_NEW, newCode);                     }                 },                 New MSLDCallback() {                     @Override                     Public void onSuccess(String msg, Object data) {                      }                     @Override                     Public void onFail(int code, String msg, Object errorData) {                     }                 });</code></pre> <h5>2.1.13 Setting a password</h5> <ul> <li>After the mobile phone number is logged in, you can set a password to log in directly using &quot;Mobile number + password&quot; later.</li> </ul> <pre><code class="language-java">MSLDSDK.action(activity, AccountPath.ROUTE_ACCOUNT_DIRECT_SET_PASSWORD,                New HashMap() {                     {                         Put(AccountParam.KEY_PASSWORD, pwd);                     }                 },                 New MSLDCallback() {                     @Override                     Public void onSuccess(String msg, Object data) {                      }                     @Override                     Public void onFail(int code, String msg, Object errorData) {                     }                 });</code></pre> <h5>2.1.14 Change Password</h5> <ul> <li>Reset password based on old password</li> </ul> <pre><code class="language-java">MSLDSDK.action(activity, AccountPath.ROUTE_ACCOUNT_DIRECT_CHANGE_PASSWORD,                New HashMap() {                     {                         Put(AccountParam.KEY_NEW_PASSWORD, pwdNew);                         Put(AccountParam.KEY_OLD_PASSWORD, pwdOld);                     }                 },                 New MSLDCallback() {                     @Override                     Public void onSuccess(String msg, Object data) {                      }                     @Override                     Public void onFail(int code, String msg, Object errorData) {                     }                 });</code></pre> <h5>2.1.15 Reset Password</h5> <ul> <li>Reset password based on phone number and verification code</li> </ul> <pre><code class="language-java">MSLDSDK.action(activity, AccountPath.ROUTE_ACCOUNT_DIRECT_RESET_PASSWORD,                New HashMap() {                     {                         Put(AccountParam.KEY_PHONE_NUMBER, phoneNumber);                         Put(AccountParam.KEY_SMS_VERIFICATION_CODE, code);                         Put(AccountParam.KEY_NEW_PASSWORD, pwdNew);                     }                 },                 New MSLDCallback() {                     @Override                     Public void onSuccess(String msg, Object data) {                      }                     @Override                     Public void onFail(int code, String msg, Object errorData) {                     }                 });</code></pre> <h5>2.1.16 Real Name Certification</h5> <ul> <li>Use the &quot;name + ID number&quot; to implement the real name function;</li> <li>Currently only real name authentication of id number type is provided.</li> </ul> <pre><code class="language-java">MSLDSDK.action(activity, AccountPath.ROUTE_ACCOUNT_DIRECT_AUTHENTICATION,                New HashMap() {                     {                         Put(AccountParam.KEY_REAL_NAME, realName);                         Put(AccountParam.KEY_CARD_ID, idCard);                     }                 },                 New MSLDCallback() {                     @Override                     Public void onSuccess(String msg, Object data) {                      }                     @Override                     Public void onFail(int code, String msg, Object errorData) {                     }                 });</code></pre> <h5>2.1.17 Get User Agreement</h5> <ul> <li>When the request is successful, the returned data is a content string in json format, such as: {&quot;version&quot;:&quot;1.0&quot;,&quot;content&quot;:&quot;html format content&quot;}</li> <li>When the game is accessed, the content field (html format) can be directly obtained for display;</li> </ul> <pre><code class="language-java">MSLDSDK.action(activity, AccountPath.ROUTE_ACCOUNT_DIRECT_USER_AGREEMENT, new HashMap&lt;&gt;(), new                 MSLDCallback() {                     @Override                     Public void onSuccess(String msg, Object data) {                      }                     @Override                     Public void onFail(int code, String msg, Object errorData) {                     }                 });</code></pre> <h5>2.1.18 Get the privacy policy</h5> <ul> <li>When the request is successful, the returned data is a content string in json format, such as: {&quot;version&quot;:&quot;1.0&quot;,&quot;content&quot;:&quot;html format content&quot;}</li> <li>When the game is accessed, the content field (html format) can be directly obtained for display;</li> </ul> <pre><code class="language-java">MSLDSDK.action(activity, AccountPath.ROUTE_ACCOUNT_DIRECT_PRIVATE_AGREEMENT, new HashMap&lt;&gt;(), new                 MSLDCallback() {                     @Override                     Public void onSuccess(String msg, Object data) {                      }                     @Override                     Public void onFail(int code, String msg, Object errorData) {                     }                 });</code></pre>

页面列表

ITEM_HTML