Skip to content

Commit 9e0426a

Browse files
committed
feat: add idfv getter method
1 parent be719e5 commit 9e0426a

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

Assets/Adjust/Unity/Adjust.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,27 @@ public static string getIdfa()
779779
#endif
780780
}
781781

782+
public static string getIdfv()
783+
{
784+
if (IsEditor())
785+
{
786+
return string.Empty;
787+
}
788+
789+
#if UNITY_IOS
790+
return AdjustiOS.GetIdfv();
791+
#elif UNITY_ANDROID
792+
Debug.Log("[Adjust]: Error! IDFV is not available on Android platform.");
793+
return string.Empty;
794+
#elif (UNITY_WSA || UNITY_WP8)
795+
Debug.Log("[Adjust]: Error! IDFV is not available on Windows platform.");
796+
return string.Empty;
797+
#else
798+
Debug.Log(errorMsgPlatform);
799+
return string.Empty;
800+
#endif
801+
}
802+
782803
public static string getSdkVersion()
783804
{
784805
if (IsEditor())

Assets/Adjust/iOS/AdjustUnity.mm

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,21 @@ void _AdjustAppWillOpenUrl(const char* url) {
412412
return idfaCStringCopy;
413413
}
414414

415+
char* _AdjustGetIdfv() {
416+
NSString *idfv = [Adjust idfv];
417+
if (nil == idfv) {
418+
return NULL;
419+
}
420+
421+
const char* idfvCString = [idfv UTF8String];
422+
if (NULL == idfvCString) {
423+
return NULL;
424+
}
425+
426+
char* idfvCStringCopy = strdup(idfvCString);
427+
return idfvCStringCopy;
428+
}
429+
415430
char* _AdjustGetAdid() {
416431
NSString *adid = [Adjust adid];
417432
if (nil == adid) {

Assets/Adjust/iOS/AdjustiOS.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ private static extern void _AdjustTrackEvent(
7979
[DllImport("__Internal")]
8080
private static extern string _AdjustGetIdfa();
8181

82+
[DllImport("__Internal")]
83+
private static extern string _AdjustGetIdfv();
84+
8285
[DllImport("__Internal")]
8386
private static extern string _AdjustGetAdid();
8487

@@ -467,6 +470,11 @@ public static string GetIdfa()
467470
return _AdjustGetIdfa();
468471
}
469472

473+
public static string GetIdfv()
474+
{
475+
return _AdjustGetIdfv();
476+
}
477+
470478
public static string GetAdid()
471479
{
472480
return _AdjustGetAdid();

0 commit comments

Comments
 (0)