Skip to main content

Obtain InstanceID (GetInstanceIDAsync)

caution

[MSDK only] The GetInstanceID API mentioned in this section is deprecated starting from MSDKV5.16. Please use getInstanceIDAsync to obtain the InstanceID.

[Player Network SDK & MSDK] The Firebase channel obtains the Firebase InstanceID.

Firebase Instance ID provides a unique identifier for each installation of an app.The Instance ID will change in the following situations:

  1. The app calls deleteInstanceId API to erase Instance ID.
  2. User uninstalls/reinstalls the app
  3. User deletes app data

Supported channel: Firebase

Supported platforms

Supports Android, iOS platform.

Function Definition

string GetInstanceID(string channel);

Input Parameters

ParametersTypeDescription
channelstringChannel definition

Code Example

UnionAdapterAPI.GetReportService().GetInstanceID("Firebase");

getInstanceIDAsync code example

// Set Extend callback
UnionAdapterAPI.GetExtendService().ExtendRetEvents += mLoginCallBack.OnExtendRetEvent;

// Call getInstanceIDAsync
UnionAdapterAPI.GetExtendService().Invoke ("Firebase", "getInstanceIDAsync", "");

// Get result in callback, the result is in extendRet.extraJson, JSON format as follows: {"instanceID":"xxxxxxx"}
public void OnExtendRetEvent (GUAExtendResult extendRet)
{
string methodTag = extendRet.extendMethodName;

mCurrentTestMgr.ShowLogInNewLine (methodTag + extendRet);
}