@@ -97,30 +97,28 @@ public static ReferrerDetails getVivoReferrer(Context context, ILogger logger) {
97
97
return referrerDetails ;
98
98
}
99
99
100
- public static String getAppSetId (Context context , ILogger logger ) {
100
+ public static String getAppSetId (Context context ) {
101
101
try {
102
- Class appSetClass = Class . forName ( "com.google.android.gms.appset.AppSet" );
103
- Method getClientMethod = appSetClass . getMethod ( "getClient" , Context . class );
104
- Object appSetIdClientObject = getClientMethod . invoke ( null , context );
105
- Method getAppSetIdInfoMethod = appSetIdClientObject . getClass (). getMethod ( "getAppSetIdInfo" );
106
- Object taskWithAppSetInfoObject = getAppSetIdInfoMethod . invoke ( appSetIdClientObject );
107
- Class tasksClass = Class . forName ( "com.google.android.gms.tasks.Tasks" );
108
- Method awaitMethod = tasksClass . getMethod ( "await" , Class . forName ( "com.google.android.gms.tasks.Task" ));
109
- Object appSetInfoObject = awaitMethod . invoke ( null , taskWithAppSetInfoObject );
110
- Method getIdMethod = appSetInfoObject . getClass (). getMethod ( "getId" );
111
-
112
- return ( String ) getIdMethod . invoke ( appSetInfoObject );
113
- } catch ( ClassNotFoundException e ) {
114
- logger . error ( "ClassNotFoundException while retrieving app set id with error: %s" , e . getMessage ());
115
- } catch ( NoSuchMethodException e ) {
116
- logger . error ( "NoSuchMethodException while retrieving app set id with error: %s" , e . getMessage ());
117
- } catch ( InvocationTargetException e ) {
118
- logger . error ( "InvocationTargetException while retrieving app set id with error: %s" , e . getMessage () );
119
- } catch (Exception e ) {
120
- logger . error ( "Exception while retrieving app set id with error: %s" , e . getMessage ()) ;
102
+ Object appSetIdClientObject =
103
+ invokeStaticMethod ( "com.google.android.gms.appset.AppSet" ,
104
+ "getClient" ,
105
+ new Class []{ Context . class }, context );
106
+
107
+ Object taskWithAppSetInfoObject =
108
+ invokeInstanceMethod ( appSetIdClientObject ,
109
+ "getAppSetIdInfo" , null );
110
+
111
+ Object appSetInfoObject =
112
+ invokeStaticMethod ( "com.google.android.gms.tasks.Tasks" ,
113
+ "await" ,
114
+ new Class []{ forName ( "com.google.android.gms.tasks.Task" )},
115
+ taskWithAppSetInfoObject );
116
+
117
+ return ( String ) invokeInstanceMethod ( appSetInfoObject ,
118
+ "getId" , null );
119
+ } catch (Throwable t ) {
120
+ return null ;
121
121
}
122
-
123
- return null ;
124
122
}
125
123
126
124
public static Class forName (String className ) {
0 commit comments