app_tracking_transparency 1.0.0+1 copy "app_tracking_transparency: ^1.0.0+1" to clipboard
app_tracking_transparency: ^1.0.0+1 copied to clipboard

outdated

This Flutter plugin allows you to display ios tracking authorization dialog and request permission to collect data.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:app_tracking_transparency/app_tracking_transparency.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _authStatus = 'Unknown';

  @override
  void initState() {
    super.initState();
    initPlugin();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlugin() async {
    TrackingStatus status;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      status = await AppTrackingTransparency.requestTrackingAuthorization();
    } on PlatformException {
      _authStatus = 'Failed to open tracking auth dialog.';
    }

    final uuid = await AppTrackingTransparency.getAdvertisingIdentifier();
    print("UUID: $uuid");

    if (!mounted) {
      return;
    }

    setState(() {
      _authStatus = "$status";
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('App Tracking Transparency Example'),
        ),
        body: Center(
          child: Text('Tracking status: $_authStatus\n'),
        ),
      ),
    );
  }
}
398
likes
0
pub points
99%
popularity

Publisher

verified publisherhe2apps.com

This Flutter plugin allows you to display ios tracking authorization dialog and request permission to collect data.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on app_tracking_transparency