Skip to content

Missing setPhoneNumber method in Flutter SDK #441

Description

@Abdelazeem777

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().phoneNumber property

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:

  1. Manually SHA256-hashing the phone number
  2. Passing it through setAdditionalData with the audiences nested 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions