GetEncodeUrl
[Player Network SDK & MSDK] Encrypts the specified URL, adds login state, and returns the encrypted URL. This synchronous interface does not require a result in the callback.
Supported Platform
- Unity
- Unreal Engine
Android, iOS, Windows
platform.Android, iOS, Windows
platform.MSDK currently does not support Windows.
Use case
GetEncryptUrl
is mainly used to open marketing campaign webpages and pass the login state to the webpages. Games call the interface and inputs the original URL, and the encrypted URL with login state is returned. The user opens the webpage through the OpenUrl
interface of the WebView module. The URL with an additional parameter (encodeparam
) is passed to the backend API to get the login state information.
GetEncryptUrl
interface requires user login to return the gameid
and channelid
information.
Example of encrypted URL:
https://www.youtube.com/?gameid=11&os=1&ts=1597840414&version=0.1.000.0001&seq=11-42e0e9d2-2f0e-4b01-a1ab-6831cf9b6165-1597840414-11&encodeparam=4060E2A762B31B8B57A8D5A9BBAF10E8657A5A3A285B0DA7159417C2D6F0D801
Function Definition
- Unity
- Unreal Engine
string GetEncodeUrl(string url);
static std::string GetEncodeUrl(const std::string &url);
Input Parameters
- Unity
- Unreal Engine
Parameter | Type | Description |
---|---|---|
url | string | URL |
Parameter | Type | Description |
---|---|---|
Url | FString | URL |
URL parameter structure
Encrypted fields (encodeparam):
Parameter | Type | Description |
---|---|---|
openid | string | Account OpenID |
token | string | Account token |
uid | string | Third-party OpenID |
Unencrypted fields:
Parameter | Type | Description |
---|---|---|
os | string | Client operating system 1 : Android 2: iOS 3: Web 4: Linux 5: Windows 6: Switch |
gameid | string | SDK assigned game ID |
channelid | int | The specified login channel |
sdk_version | string | SDK version |
user_name | string | Username |
ts | string | Time stamp |
seq | string | Sequence ID |
Do not enter the above fields. Player Network SDK will get the information after user login.
Callback Processing
The callback processing API is GUAWebViewResultObserver. The callback data structure is GUAWebViewRet.
- Unity
- Unreal Engine
The callback event is WebViewRetEvents.
The callback methodID is GUA_WEBVIEW_GET_ENCRYPT_URL
.
The callback event is OnWebViewOptNotify.
The callback methodID is kMethodIDWebviewGetEncodeUrl
.
Code Sample
- Unity
- Unreal Engine
string url = UnionAdapterAPI.GetWebViewService().GetEncodeUrl("http://www.facebook.com");
FString url = GUA_NAMESPACE::GUAWebViewService::GetEncodeUrl("http://www.facebook.com");