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:
- App calls
deleteInstanceId
to delete Instance ID. - User uninstalls and reinstalls app.
- User deletes app data.
Supported channel: Firebase
Supported Platform
- Unity
- Unreal Engine
Supports
Android, iOS
platform.Supports
Android, iOS
platform.Function Definition
- Unity
- Unreal Engine
string GetInstanceID(string channel);
static std::string GetInstanceID(const std::string &channel);
Input Parameters
- Unity
- Unreal Engine
Parameter | Type | Description |
---|---|---|
channel | string | Specified channel to get Instance ID |
Parameter | Type | Description |
---|---|---|
channel | std::string | Specified channel to get Instance ID |
Code Sample
- Unity
- Unreal Engine
UnionAdapterAPI.GetReportService().GetInstanceID("Firebase");
GUA_NAMESPACE::GUAReportService::GetInstanceID("Firebase");
getInstanceIDAsync Code Sample
- Unity
- Unreal Engine
// 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);
}
// Add Extend callback
GUA_NAMESPACE::GUAExtendService::SetExtendObserver(mGUAExtendCallBacks);
// Call getInstanceIDAsync
GUA_NAMESPACE::GetExtendService::Invoke("Firebase", "getInstanceIDAsync", "");
// Get result from Extend callback, the result in extendRet.extraJson is a JSON string with format {"instanceID":"xxxxxxx"}
class MyExtendObserver : public GUA_NAMESPACE::GUAExtendObserver {
public:
void OnExtendNotify(const GUAExtendResult &extendRet) {
handleCallback(extendRet, extendRet.method_id);
};
};