-
Notifications
You must be signed in to change notification settings - Fork 136
Missing setPhoneNumber method in Flutter SDK #441
Description
Description
The native Android and iOS AppsFlyer SDKs both expose a setPhoneNumber method for passing user phone numbers for server-side conversion matching:
- Android:
AppsFlyerLib.getInstance().setPhoneNumber(String phoneNumber)— automatically SHA-256 hashes the phone number - iOS:
AppsFlyerLib.shared().phoneNumberproperty
However, the Flutter plugin (appsflyer_sdk) does not expose this method. There is no method channel handler for it in either the Android (AppsflyerSdkPlugin.java) or iOS (AppsflyerSdkPlugin.m) bridge code.
Why this matters
Ad platforms (Snapchat, Meta, TikTok) need user identifiers for server-side attribution matching. Without setPhoneNumber, Flutter developers must work around this by:
- Manually SHA256-hashing the phone number
- Passing it through
setAdditionalDatawith theaudiencesnested structure (phone_number_sha256,phone_number_e164_sha256)
This is inconsistent with setUserEmails, which is exposed in the Flutter SDK and handles hashing internally via EmailCryptType.EmailCryptTypeSHA256.
Current workaround
import 'package:crypto/crypto.dart';
final hash = sha256.convert(utf8.encode(phoneE164)).toString();
appsflyerSdk.setAdditionalData({
'audiences': {
'phone_number_sha256': hash,
'phone_number_e164_sha256': hash,
}
});Request
Could setPhoneNumber be added to the Flutter plugin for parity with the native SDKs? I understand the native method is marked as "soon to be deprecated", but having a consistent API surface across all SDKs would be helpful — or at minimum, documenting the recommended Flutter-specific workaround.
Environment
appsflyer_sdk: ^6.17.7+1- Flutter 3.x
- Dart 3.x