Skip to content

Mini-IT/AdvertisingIdentifierFetcher

Repository files navigation

Advertising Identifier Fetcher

In Unity 2020+ Application.RequestAdvertisingIdentifierAsync returns nothing. Forum thread #1 thread #2

This package uses AdvertisingIdClient

Usage

MiniIT.Utils.AdvertisingIdFetcher.RequestAdvertisingId((advertisingId, trackingEnabled, error) =>
{
	Debug.Log("advertisingId = " + advertisingId);
});

Optionally you may specify a timeout in milliseconds for this operation by passing the second parameter. Default timeout is 1000 ms. If the operation lasts longer, it is forced to stop and the callback will be called with an empty string as a parameter.

If the timeout value is less or equal to zero, no timeout is applied.

Installation

To add AdvertisingIdFetcher to your project follow these instructions using this Git URL:

https://github.com/Mini-IT/AdvertisingIdentifierFetcher.git

Resolving dependencies

External Dependency Manager for Unity will help you to resolve dependencies.

Or alternatively you can do it manually following these steps:

  • Create custom main gradle template file. Project Settings -> Player -> Android Tab -> Publish Settings -> Custom Main Gradle Template Tick;
  • Open Assets/Plugins/Android/mainTemplate.gradle with any text editor and add the following line into dependencies section:
implementation 'com.google.android.gms:play-services-ads-identifier:16.0.0'

Android only

Advertising Identifier Fetcher uses conditional compilation. On any other platform but Android Application.RequestAdvertisingIdentifierAsync will be used.

About

No description, website, or topics provided.

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta

Stars

Watchers

Forks

Packages

No packages published

Languages