Skip to content

Commit f8df1b6

Browse files
authored
Merge pull request #133 from adobe/dev-v5.0.0
Dev v5.0.0 -> Staging
2 parents 7b6268a + 9603deb commit f8df1b6

81 files changed

Lines changed: 1412 additions & 1047 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -27,60 +27,59 @@ This repository is a monorepo. It contains a collection of Adobe Experience Plat
2727

2828
First, make sure that `Flutter` is [installed](https://docs.flutter.dev/get-started/install).
2929

30-
Now to install the package, run:
30+
### Installing using Terminal:
31+
32+
Install the package, run:
3133

3234
```bash
3335
cd MyFlutterApp
3436
flutter pub add flutter_{plugin_name}
3537
```
3638

37-
This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):
39+
This will automatically update your package's pubspec.yaml with the dependency, and run an implicit `flutter pub get`.
40+
41+
### Installing Manually:
42+
43+
Alternatively, Editing pubspec.yaml manually with dependencies.
3844

3945
```
4046
dependencies:
4147
flutter_{plugin_name}: ^{latest_version}
4248
```
43-
44-
Now import the plugin in your Dart code as follows:
49+
Run:
4550

4651
```
47-
import 'package:flutter_{extension}/flutter_{plugin_name}.dart'
52+
flutter pub get
4853
```
4954

50-
Install instructions for each respective plugin can be found in each plugin's readme: `/plugins/{plugin_name}/README.md`. Start by installing `flutter_aepcore` which is a dependency for all other extensions.
51-
52-
## Usage
53-
54-
### Initializing
55-
56-
Initializing the SDK should be done in native code (AppDelegate / SceneDelegate for iOS and Application class for Android). Documentation for initializing the SDK can be found [here](https://developer.adobe.com/client-sdks/documentation/getting-started/get-the-sdk/#2-add-initialization-code). The linked documentation initalizes the User Profile extension which is not required or supported in Flutter.
57-
58-
As part of the initialization code, make sure that you set the SDK wrapper type to `Flutter` before you start the SDK.
55+
#### iOS development
5956

60-
#### iOS:
57+
For iOS development, after installing the plugin packages, download the pod dependencies by running the following command to link the libraries to your Xcode project :
6158

62-
Add the initialization code in [AppDelegate.m or AppDelegate.swift](/example/ios/Runner/AppDelegate.m#L9) file of the generated iOS project.
59+
```bash
60+
cd ios && pod install && cd ..
61+
```
62+
To update native dependencies to latest available versions, run the following command:
6363

64-
#### Android:
65-
Create an [Application class](/example/android/app/src/main/java/com/adobe/marketing/mobile/flutter/flutter_aepsdk_example/MyApplication.java) which extends [FlutterApplication](https://api.flutter.dev/javadoc/io/flutter/app/FlutterApplication.html) and add the initialization code. Change your [AndroidManifest.xml](/example/android/app/src/main/AndroidManifest.xml#L9) to reference this new class.
64+
```bash
65+
cd ios && pod update && cd ..
66+
```
67+
## Importing the Plugin
6668

67-
Once you have added the initialization code to your app, be sure to set the SDK wrapper type to Flutter before you start the SDK.
69+
For both installation methods, you need to import the package in your **Dart** code as follows:
6870

69-
###### iOS:
70-
Swift:
71-
```swift
72-
MobileCore.setWrapperType(.flutter)
7371
```
74-
75-
Objective-C:
76-
```objective-c
77-
[AEPMobileCore setWrapperType:AEPWrapperTypeFlutter];
72+
import 'package:flutter_{extension}/flutter_{plugin_name}.dart'
7873
```
7974

80-
###### Android:
81-
```java
82-
MobileCore.setWrapperType(WrapperType.FLUTTER);
83-
```
75+
## Initializing
76+
77+
Then, initialize the SDK using the following methods:
78+
- [MobileCore.initializeWithAppId(appId)](https://github.com/adobe/aepsdk_flutter/tree/main/plugins/flutter_aepcore#initializewithappid)
79+
- [MobileCore.initialize(initOptions)](https://github.com/adobe/aepsdk_flutter/tree/main/plugins/flutter_aepcore#initialize)
80+
81+
> [!NOTE]
82+
> Starting from Adobe Experience Platform Flutter **5.x**, there is no longer a need to initialize the SDK on the [native platforms](https://github.com/adobe/aepsdk_flutter/tree/v4.x?tab=readme-ov-file#usage), as was required in earlier versions.
8483
8584
## Tests
8685

docs/migration.md

Lines changed: 37 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Update your `pubspec.yml` file to point to the new plugin as so:
1111

1212
dependencies:
1313
- flutter_acpcore: ^2.0.0
14-
+ flutter_aepcore: ^4.0.0
14+
+ flutter_aepcore: ^5.0.0
1515

1616
...
1717
```
@@ -27,135 +27,53 @@ Updated plugins can be found in this repository under [plugins/](https://github.
2727
| Place Services| NA |
2828
| Place Monitor | NA |
2929

30-
## Update SDK initialization
31-
32-
Remove the deprecated registration code and the extensions that are not supported in AEP Flutter libraries.
33-
34-
### Android
30+
## Update import plugins
3531
```diff
36-
import com.adobe.marketing.mobile.AdobeCallback;
37-
import com.adobe.marketing.mobile.Identity;
38-
import com.adobe.marketing.mobile.InvalidInitException;
39-
import com.adobe.marketing.mobile.Lifecycle;
40-
import com.adobe.marketing.mobile.LoggingMode;
41-
import com.adobe.marketing.mobile.MobileCore;
42-
import com.adobe.marketing.mobile.Signal;
43-
import com.adobe.marketing.mobile.Assurance;
44-
import com.adobe.marketing.mobile.UserProfile;
45-
...
46-
import android.app.Application;
47-
import io.flutter.app.FlutterApplication;
48-
...
49-
public class MyApplication extends FlutterApplication {
50-
...
51-
@Override
52-
public void on Create(){
53-
super.onCreate();
54-
...
55-
MobileCore.setApplication(this);
56-
MobileCore.setLogLevel(LoggingMode.DEBUG);
57-
MobileCore.setWrapperType(WrapperType.FLUTTER);
58-
59-
- try {
60-
- Identity.registerExtension();
61-
- Lifecycle.registerExtension();
62-
- Signal.registerExtension();
63-
- Assurance.registerExtension();
64-
- UserProfile.registerExtension();
65-
- Analytics.registerExtension();
66-
- Places.registerExtension();
67-
- MobileCore.start(new AdobeCallback () {
68-
- @Override
69-
- public void call(Object o) {
70-
- MobileCore.configureWithAppID("yourAppID");
71-
- }
72-
- });
73-
- } catch (InvalidInitException e) {
74-
75-
List<Class<? extends Extension>> extensions = Arrays.asList(
76-
Identity.EXTENSION,
77-
Lifecycle.EXTENSION,
78-
Signal.EXTENSION,
79-
Assurance.EXTENSION,
80-
UserProfile.EXTENSION
81-
);
82-
MobileCore.registerExtensions(extensions, o -> MobileCore.configureWithAppID("YourEnvironmentFileID"));
83-
...
84-
}
85-
}
86-
}
32+
- import 'package:flutter_acpcore/flutter_acpcore.dart';
33+
+ import 'package:flutter_aepcore/flutter_aepcore.dart';
8734
```
8835

89-
### iOS
9036

91-
> Note: For iOS app, after installing the AEP-prefixed packages, please update native dependecies by running the following command: `cd ios && pod update && cd ..`
9237

93-
```objectivec
9438

95-
// 1. remove the following header files
96-
//#import "ACPCore.h"
97-
//#import "ACPUserProfile.h"
98-
//#import "ACPIdentity.h"
99-
//#import "ACPLifecycle.h"
100-
//#import "ACPSignal.h"
39+
## Update SDK initialization
10140

102-
// 2. import AEP extensions
103-
@import AEPCore;
104-
@import AEPUserProfile;
105-
@import AEPLifecycle;
106-
@import AEPIdentity;
107-
@import AEPServices;
108-
@import AEPSignal;
109-
@import AEPAssurance;
110-
// --- 2. end ----
41+
> [!NOTE]
42+
> Starting from Adobe Experience Platform Flutter **5.x**, there is no longer a need to initialize the SDK on the [native platforms](https://github.com/adobe/aepsdk_flutter/tree/v4.x?tab=readme-ov-file#usage), as was required in earlier versions.
11143
112-
...
113-
@implementation AppDelegate
114-
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
115-
// 3. remove the following code for initializing ACP SDKs
116-
117-
// [ACPCore setLogLevel:ACPMobileLogLevelDebug];
118-
// [ACPCore configureWithAppId:@"yourAppID"];
119-
// [ACPUserProfile registerExtension];
120-
// [ACPIdentity registerExtension];
121-
// [ACPLifecycle registerExtension];
122-
// [ACPSignal registerExtension];
123-
// [ACPAnalytics registerExtension];
124-
125-
// const UIApplicationState appState = application.applicationState;
126-
// [ACPCore start:^{
127-
// if (appState != UIApplicationStateBackground) {
128-
// [ACPCore lifecycleStart:nil];
129-
// }
130-
// }];
131-
132-
// 4. add code to initializing AEP SDKs
133-
134-
[AEPMobileCore setLogLevel: AEPLogLevelDebug];
135-
[AEPMobileCore configureWithAppId:@"yourAppID"];
136-
137-
const UIApplicationState appState = application.applicationState;
138-
139-
[AEPMobileCore registerExtensions: @[
140-
AEPMobileLifecycle.class,
141-
AEPMobileSignal.class,
142-
AEPMobileIdentity.class,
143-
AEPMobileUserProfile.class,
144-
AEPMobileAssurance.class,
145-
] completion:^{
146-
if (appState != UIApplicationStateBackground) {
147-
[AEPMobileCore lifecycleStart:nil}];
148-
}
149-
}];
150-
// --- 4. end ----
151-
152-
...
153-
return YES;
154-
}
44+
Remove all the ACP registration code and the extensions code on the native `Android` and `iOS` platforms.
45+
46+
Initialize AEP SDK in the **Dart** application:
47+
48+
**Example**
49+
50+
```dart
51+
class _HomePageState extends State<HomePage> {
52+
/// Initialize the Adobe Experience Platform Mobile SDK inside the initState method.
53+
@override
54+
void initState() {
55+
super.initState();
56+
_initializeAEPMobileSdk();
57+
}
58+
59+
Future<void> _initializeAEPMobileSdk() async {
60+
MobileCore.setLogLevel(LogLevel.trace);
61+
MobileCore.initializeWithAppId(appId:"YOUR_APP_ID");
62+
63+
// For more granular control over the initial options, you can use the following sample code:
64+
// InitOptions initOptions = InitOptions(
65+
// appId: "YOUR_APP_ID",
66+
// lifecycleAutomaticTrackingEnabled: true,
67+
// lifecycleAdditionalContextData: {"key": "value"},
68+
// appGroupIOS: "group.com.example",
69+
// );
15570
156-
@end
71+
// MobileCore.initialize(initOptions: initOptions);
72+
}
15773
```
15874

75+
Refer to the initializing details info [here](https://github.com/adobe/aepsdk_flutter/tree/main?tab=readme-ov-file#initializing).
76+
15977
## Update API usage and references for each extension
16078

16179
### Core

example/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,15 @@ A few resources to get you started if this is your first Flutter project:
1111
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
1212
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
1313

14-
For help getting started with Flutter, view our
14+
For help getting started with Flutter, view the
1515
[online documentation](https://flutter.dev/docs), which offers tutorials,
1616
samples, guidance on mobile development, and a full API reference.
1717

1818

1919
## How to run the example app:
2020

2121
### Add your App Id:
22-
In `ios/Runner/AppDelegate.m`, find the call to `configureWithAppId` and add your app id.
23-
24-
In `android/**/MyApplication.java`, find the call to `configureWithAppId` and add your app id.
22+
In `lib/main.dart`, locate the call to `MobileCore.initializeWithAppId(appId:"YOUR_APP_ID")` and replace `"YOUR_APP_ID"` with your property App Id.
2523

2624
#### Run instructions for Android:
2725

example/android/app/build.gradle

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
plugins {
2+
id "com.android.application"
3+
id "kotlin-android"
4+
id "dev.flutter.flutter-gradle-plugin"
5+
}
6+
17
def localProperties = new Properties()
28
def localPropertiesFile = rootProject.file('local.properties')
39
if (localPropertiesFile.exists()) {
@@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
612
}
713
}
814

9-
def flutterRoot = localProperties.getProperty('flutter.sdk')
10-
if (flutterRoot == null) {
11-
throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12-
}
13-
1415
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1516
if (flutterVersionCode == null) {
1617
flutterVersionCode = '1'
@@ -21,9 +22,6 @@ if (flutterVersionName == null) {
2122
flutterVersionName = '1.0'
2223
}
2324

24-
apply plugin: 'com.android.application'
25-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
26-
2725
android {
2826
compileSdk 34
2927
namespace 'com.adobe.marketing.mobile.flutter.flutter_aepsdk_example'

example/android/app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
additional functionality it is fine to subclass or reimplement
77
FlutterApplication and put your custom class here. -->
88
<application
9-
android:name=".MyApplication"
109
android:label="flutter_aepsdk_example"
1110
android:icon="@mipmap/ic_launcher">
1211
<activity
@@ -36,7 +35,6 @@
3635
android:host="adobe" />
3736
</intent-filter>
3837
</activity>
39-
4038
<meta-data
4139
android:name="flutterEmbedding"
4240
android:value="2" />

0 commit comments

Comments
 (0)