Skip to main content

GetInstanceIDAsync

caution

[MSDK Only] The GetInstanceID interface is deprecated from MSDK V5.16 onwards, use getInstanceIDAsync to get InstanceID instead.

[Player Network SDK & MSDK] For Firebase to get Firebase InstanceID.

Firebase Instance ID is a unique identifier for each app installation. Instance ID changes under the following circumstances:

  1. App calls deleteInstanceId to delete Instance ID.
  2. User uninstalls and reinstalls app.
  3. User deletes app data.

Supported channel: Firebase

Supported Platform

Supports Android, iOS platform.

Function Definition

string GetInstanceID(string channel);

Input Parameters

ParameterTypeDescription
channelstringSpecified channel to get Instance ID

Code Sample

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

getInstanceIDAsync Code Sample

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

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

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

mCurrentTestMgr.ShowLogInNewLine (methodTag + extendRet);
}