Skip to content

feat(core): add MobileCore.setPushIdentifier API#158

Open
brunogabriel wants to merge 9 commits into
adobe:mainfrom
brunogabriel:feat/custom-ids
Open

feat(core): add MobileCore.setPushIdentifier API#158
brunogabriel wants to merge 9 commits into
adobe:mainfrom
brunogabriel:feat/custom-ids

Conversation

@brunogabriel
Copy link
Copy Markdown

@brunogabriel brunogabriel commented Apr 24, 2026

Add `MobileCore.setPushIdentifier(String? token) API to the Flutter wrapper for the Adobe Experience Platform Core SDK.

Related Issue

Motivation and Context

Flutter developers using Adobe Journey Optimizer are forced to write native Android/iOS code to call setPushIdentifier, since the method was missing from the Flutter wrapper. This was reported in the Experience League community:
https://experienceleaguecommunities.adobe.com/adobe-journey-optimizer-15/flutter-and-push-notifications-116363

How Has This Been Tested?

Added unit tests in plugins/flutter_aepcore/test/flutter_aepcore_test.dart covering both methods (token and null cases). All 25 tests in flutter_aepcore_test.dart pass. All tests across all plugins pass (flutter test in each plugin directory).
Tested in both platforms Android and iOS to receive a push.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Expose setPushIdentifier on Android and iOS so Flutter apps can
register a push notification token directly through the Dart API
without dropping down to native code.

- Dart: MobileCore.setPushIdentifier(String? token)
- Android: handleSetPushIdentifier follows handleSetAdvertisingIdentifier pattern
- iOS: converts NSString token to NSData via NSUTF8StringEncoding before
  calling [AEPMobileCore setPushIdentifier:]
- Tests: added group covering token and null cases
- Docs: CHANGELOG 5.0.2 entry and README API section
Add a second method that accepts Uint8List? and passes the bytes
directly to [AEPMobileCore setPushIdentifier:] as NSData on iOS,
without any UTF-8 or hex encoding — which is the correct behaviour
for raw APNs device tokens.

On Android the method is a no-op with a debug log; developers should
use setPushIdentifier(String?) with the FCM token there.

- Dart: import dart:typed_data, add setPushIdentifierWithData(Uint8List?)
- iOS: handleSetPushIdentifierWithData uses FlutterStandardTypedData.data
- Android: no-op handler with debug log
- Tests: 25/25 passing
@brunogabriel brunogabriel marked this pull request as draft April 24, 2026 00:47
@brunogabriel brunogabriel marked this pull request as ready for review April 24, 2026 18:01
…ersion

- Remove setPushIdentifierWithData; a single setPushIdentifier(String?) now
  handles both Android (FCM token) and iOS (APNs hex token)
- Fix iOS bridge: convert hex string to NSData internally instead of
  UTF-8 encoding, which was registering wrong bytes with the AEP SDK
- Fix corrupted .gitignore line that merged two entries into one
- Update CHANGELOG, README and tests accordingly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants