in-app-payments-flutter-plugin icon indicating copy to clipboard operation
in-app-payments-flutter-plugin copied to clipboard

refactor(android): remove v1 embedding APIs and update to FlutterActi…

Open Sahad2701 opened this issue 7 months ago • 4 comments

…vity

Summary

Migrate plugin to Android V2 embedding and remove deprecated registerWith() usage

Related issues

Related Issues

  • related to deprecated Android plugin API usage
  • Improves compatibility with modern Flutter projects
  • Prepares plugin for future-proof integration

Fix #

  • Deprecated registerWith() method removed
  • Introduced FlutterPlugin lifecycle (onAttachedToEngine / onDetachedFromEngine)
  • Added optional ActivityAware for activity access if needed

Changelog

  • Removed deprecated registerWith() method
  • Implemented FlutterPlugin for proper registration
  • Added ActivityAware support for activity-based operations
  • Ensured backward compatibility and proper cleanup in onDetachedFromEngine
  • message This commit upgrades the Android side of the plugin to use the Flutter V2 plugin API. The deprecated registerWith() method has been removed and replaced with the recommended onAttachedToEngine() lifecycle method. ActivityAware was also implemented to manage activity context when needed. This aligns with Flutter's current standards and avoids runtime warnings in apps using this plugin.

Test Plan

  • Run flutter build apk to ensure no compile-time errors
  • Verified plugin registration in both debug and release builds
  • Tested method channel communication between Dart and native
  • Confirmed activity-based features (if used) are functioning correctly

Sahad2701 avatar Apr 04 '25 17:04 Sahad2701

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Apr 04 '25 17:04 CLAassistant

Building still complains about error: cannot find symbol for io.flutter.plugin.common.PluginRegistry.Registrar in CardEntryModule.java, GooglePayModule.java and SquareInAppPaymentsFlutterPlugin.java.

minkyn avatar Apr 08 '25 06:04 minkyn

I think the fix is simply removing unused private constructors for those three java files. Can you please update those files?

minkyn avatar Apr 10 '25 18:04 minkyn

you should resolve this issue very quickly lots of our Square client are having issue with new release. @CLAassistant @plinio-square

vishalbaps avatar May 29 '25 10:05 vishalbaps

Any updates on when this will be merged?

irasantiago avatar Jun 26 '25 14:06 irasantiago