Skip to content

Instantly share code, notes, and snippets.

@jinqian
Created March 5, 2015 16:13
Show Gist options
  • Save jinqian/d217546ca2e406006681 to your computer and use it in GitHub Desktop.
Save jinqian/d217546ca2e406006681 to your computer and use it in GitHub Desktop.
set ad id in cookies
new Thread(new Runnable() {
@Override
public void run() {
AdvertisingIdClient.Info adInfo = null;
try {
adInfo = AdvertisingIdClient.getAdvertisingIdInfo(mContext);
} catch (IOException | GooglePlayServicesNotAvailableException | GooglePlayServicesRepairableException e) {
e.printStackTrace();
}
String advertisingId = "";
if (adInfo != null) {
advertisingId = adInfo.getId();
}
mCookieManager.initCookies(mContext, eventType, advertisingId);
}
}).start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment