Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to integrate a flutter program into an existing Android application that already has adobe integration #95

Open
freemansoft opened this issue Apr 10, 2024 · 5 comments

Comments

@freemansoft
Copy link

Expected Behaviour

We want to include Adobe Analytics from a flutter program that is embedded in mobile applications that already use Adobe Analytics. There should be documentation or an example to support this or a disclaimer that it doesnt'.

Actual Behaviour

  1. The instructions say to replace the Android main program with FlutterApplication. Changing the main program may not be a viable solution for an existing application. Flutter Android builds don't include an application program by default.
  2. Typically an embedded Flutter program is integrated as an activity.
  3. The example pram sets the wrapper mode flutter. MobileCore.setWrapperType(WrapperType.FLUTTER); Is this valid in an embedded module?

Reproduce Scenario (including but not limited to)

See above

Steps to Reproduce

See above

Platform and Version

Not applicable

Sample Code that illustrates the problem

https://github.com/adobe/aepsdk_flutter/blob/main/example/android/app/src/main/java/com/adobe/marketing/mobile/flutter/flutter_aepsdk_example/MyApplication.java

Logs taken while reproducing problem

Not applicable

@cacheung
Copy link
Contributor

Can you elaborate more about the usage?
We need to register Adobe Mobile SDK extensions in Main Application of Android.

//sample registration code

 public void onCreate() {
        super.onCreate();

        MobileCore.setApplication(this);
        MobileCore.setLogLevel(LoggingMode.VERBOSE);
        MobileCore.setWrapperType(WrapperType.FLUTTER);

        List<Class<? extends Extension>> extensions = Arrays.asList(
                com.adobe.marketing.mobile.edge.identity.Identity.EXTENSION,
                com.adobe.marketing.mobile.Identity.EXTENSION,
                EdgeBridge.EXTENSION,
                Lifecycle.EXTENSION,
                Signal.EXTENSION,
                Edge.EXTENSION,
                Assurance.EXTENSION,
                Consent.EXTENSION,
        );

In your Android mobile application, how do you implement Adobe Analytics? Which Mobile SDK extensions you use? How do you send data to Analytics?
Use trackAction/trackState API or Use Edge.sendEvent API?

And you want to add a Flutter embedded program which also can send data to Adobe Analytics? How are you going to send data to Analytics from Flutter? Use trackAction/trackState API or Edge.sendEvent API?

General Info about how Adobe Mobile SDK send data to Analytics.
https://developer.adobe.com/client-sdks/solution/adobe-analytics/migrate-to-edge-network/

@freemansoft
Copy link
Author

We have existing native applications that we are extending with a Flutter module. The existing application already has Adobe metrics in it using the SDK.

The Flutter instructions say the application needs to use FlutterApplication (or is it activity, anyway) but our existing app doesn't use that.

The instructions say to set the wrapper type to WrapperType.Flutter. Does that break or affect the existing metrics in anyway? Why is the WrapperType required?

@cacheung
Copy link
Contributor

@freemansoft Setting MobileCore.setWrapperType(WrapperType.FLUTTER); mainly helps to identify the platform in the Analytics metrics. So you can tell the data is coming from a flutter app.
While you have existing native application implementation, without setting WrapperType.FLUTTER won't affect the functionality.

@freemansoft
Copy link
Author

We have an existing Native app that we are extending with Flutter code running in a fragment.

  1. We are going to run flutter code in a module that runs inside the existing native application.
  2. We are going to be generating metrics from both the existing mobile native code and the flutter code running inside of it.

The mode switch looks global so it sounds like everything will get tagged as flutter metrics if we use WrapperType.FLUTTER

@cacheung
Copy link
Contributor

We haven't tested or officially supported the scenario of running Flutter module in an existing native application. In this case, I am not sure your use case if you are going to call aepsdk_flutter SDK API from the flutter module or you have all the analytics code on the Native side. e.g trackAction/trackState calls.

And for aepsdk_flutter, we don't support Analytics plugins (https://github.com/adobe/aepsdk_flutter?tab=readme-ov-file#about-this-project). For sending data to Analytics on Flutter, it needs to go through EdgeBridge and Edge plugins.

I am not sure how that works if your native implementation uses Analytics extension. You will need to run some tests to see the behavior.

WrapperType.FLUTTER is just for a platform reporting purpose. You can decide if you want to include that in your sdk initialization code. If your aepsdk mobile sdk code is only in Android, then there is no need to include that.

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

No branches or pull requests

2 participants