B4A Library GoogleAdvertisingIdClient

Hi group.

This small lib gives the info fields for the AdvertisingIdClient in the device.

The java code is quite small. :)

B4X:
public class AdvertiserId {

    public void Initialize(final BA ba, final String EventName) {
       BA.runAsync(ba, this, EventName + "_ready", new Object[] {"",false}, new Callable<Object[]>() {
            @Override
            public Object[] call() throws IOException,IllegalStateException,GooglePlayServicesNotAvailableException,GooglePlayServicesRepairableException   {
                AdvertisingIdClient.Info adInfo = AdvertisingIdClient.getAdvertisingIdInfo(ba.context);
                return new Object[] {adInfo.getId(), adInfo.isLimitAdTrackingEnabled() };
            }
        });
    }

}

it requires the same project setup as the admob lib.
 

Attachments

  • AdvertiserIdTest.zip
    6.4 KB · Views: 163
  • AdvertiserIDLib.zip
    2.4 KB · Views: 145
Top