🚀 Hey there, Flutterflow folks! I'd like to share a crucial step for those interested in publishing their apps on iOS: installing the App Transparency feature.
📱 But first, what is App Transparency? It's a feature that allows users to authorize tracking of their activities in apps and websites from other companies, whether for advertising purposes or data sharing with third parties.
To integrate this function into your app, follow these steps:
Creation of a Custom appTracking Action.
Adding appTracking to main.dart.
Creating permissions in Info.plist.
Creation of a Custom appTracking Action
Access the Flutterflow menu and select the Custom Actions option. Click the +add button to create a new custom action named appTracking. Keep the return value as False, then copy the necessary dependency name from the provided link and add it as a new dependency.
Here's the code:
import 'dart:io';
// Importar dependência app_tracking_transparency
import 'package:app_tracking_transparency/app_tracking_transparency.dart';
Future appTracking() async {
if (Platform.isIOS) {
final TrackingStatus status =
await AppTrackingTransparency.trackingAuthorizationStatus;
// Se o sistema puder mostrar uma caixa de diálogo de solicitação de autorização
if (status == TrackingStatus.notDetermined) {
await Future.delayed(const Duration(milliseconds: 200));
await AppTrackingTransparency.requestTrackingAuthorization();
}
await AppTrackingTransparency.getAdvertisingIdentifier();
}
}
Adding appTracking to main.dart
After setting up the Custom Actions, access the main.dart file. Add the appTracking action to the Initial Actions section by clicking the corresponding button.
Creating permissions in Info.plist
Finally, it is necessary to update the Info.plist file by adding the NSUserTrackingUsageDescription key with a customized message describing the use of data. This configuration is done on the Permissions page.
With these steps completed, your application will be ready to be compiled for iOS and to undergo the necessary tests.
I hope these tips are helpful in your journey with Flutterflow. Leave your comment or reaction if you want more content on this exciting subject!
Let's code with style! 🎉