A Flutter plugin for fetching Advertising info from Android and iOS
- Add
advertising_info
to your package's pubspec.yaml file: - Get package by
$ flutter pub get
Import it to your source code
import 'package:advertising_info/advertising_info.dart';
Call AdvertisingInfo.read();
to get Advertising info from platform(iOS or Android)
AdvertisingInfo advertisingInfo = await AdvertisingInfo.read();
Call AdvertisingInfo.id
to get advertising id (IDFA for iOS, GAID for Android)
String advertising_id = advertisingInfo.id
Call AdvertisingInfo.isLimitAdTrackingEnabled
to check if user has limited Ad tracking or not.
Bool isLAT = advertisingInfo.isLimitAdTrackingEnabled
- false: Ad Tracking is not limited (Able to get advertising id)
- true: Ad Tracking is limited (Unable to get advertising id)
Call AdvertisingInfo.authorizationStatus
to check authorization status by users. (mainly for iOS14)
AauthorizationStatus status = advertisingInfo.authorizationStatus
AauthorizationStatus
is an enum with values below
enum AdTrackingAuthorizationStatus {
notDetermined,
restricted,
denied,
authorized
}