FLUTTER ECOSYSTEM

operando/advertising_id

A Flutter plugin to access advertising ID.

advertising_id project cover
Stars
14
Forks
38
Last push (UTC)
Sep 6, 2024
Project status
Archived
Shinobu Okano GitHub avatar
GITHUB User

Shinobu Okano ↗

LanguagesRubyKotlinDartSwiftObjective-CMakefile

Technical topics

Packages published by this repository

Dependencies used

Dependency list 1 items
  • flutter{"sdk":"flutter"}

Original README

English project snapshot. Visit GitHub for the latest content.

Expand / collapse project README

pub package

advertising_id

A Flutter plugin to access advertising ID.

Wraps ASIdentifierManager.advertisingIdentifier (on iOS) and advertising ID (on Android).

Getting Started

Run this command

 flutter pub add advertising_id

This will add a line like this to your package's pubspec.yaml

dependencies:
  ....
  advertising_id: ^2.7.1

Usage

AdvertisingId.id

Get advertising ID.

String? advertisingId;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
  advertisingId = await AdvertisingId.id(true);
} on PlatformException {
  advertisingId = null;
}
AdvertisingId.isLimitAdTrackingEnabled

Retrieves whether the user has limit ad tracking enabled or not.

bool? isLimitAdTrackingEnabled;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
  isLimitAdTrackingEnabled = await AdvertisingId.isLimitAdTrackingEnabled;
} on PlatformException {
  isLimitAdTrackingEnabled = false;
}