Android Question B4XPages GetAdvertisingId

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I am converting an App to B4XPages I use to have the GetAdvertisingId routine in my main https://www.b4x.com/android/forum/threads/advertising-id.101050/#content

When I move it to my B4XMainPage I get the following error:

1602362762547.png


How do I change the Java code to work in B4XMainPage or should I just leave it in Main?
{code]
#if Java
import java.util.concurrent.Callable;
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
import com.google.android.gms.ads.identifier.AdvertisingIdClient.Info;

public static void GetAdvertisingId() {
BA.runAsync(processBA, mostCurrent, "advertisingid_ready", new Object[] {false, ""}
, new Callable<Object[]>() {
@override
public Object[] call() throws Exception {
String id = AdvertisingIdClient.getAdvertisingIdInfo(mostCurrent).getId();
return new Object[] {true, id};
}
}); }
#End If
[/code]
 
Top