Skip to content

Conversation

@Sahad2701
Copy link

@Sahad2701 Sahad2701 commented Apr 4, 2025

…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

@CLAassistant
Copy link

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.

@minkyn
Copy link

minkyn commented Apr 8, 2025

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

@minkyn
Copy link

minkyn commented Apr 10, 2025

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

public void onAttachedToEngine(FlutterPluginBinding flutterPluginBinding) {
channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "square_in_app_payments");

channel.setMethodCallHandler(new SquareInAppPaymentsFlutterPlugin());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be "this"?

@vishalbaps
Copy link

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

@irasantiago
Copy link

Any updates on when this will be merged?

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.

5 participants