From ec0aafc8758ebd7e8d2c32cc1e9bd9ab7f59c512 Mon Sep 17 00:00:00 2001 From: Calise Cheung Date: Fri, 20 Jan 2023 14:29:13 -0800 Subject: [PATCH 01/16] Update doc for v.2.0.0 Update implementation from 2+ to 2.0.0 Update sample code in doc. --- Documentation/api-reference.md | 3 ++ Documentation/getting-started.md | 53 ++++++++++++++++++++------------ README.md | 16 ++++------ 3 files changed, 43 insertions(+), 29 deletions(-) diff --git a/Documentation/api-reference.md b/Documentation/api-reference.md index 218a5dc7..d8f4c5d4 100644 --- a/Documentation/api-reference.md +++ b/Documentation/api-reference.md @@ -134,6 +134,9 @@ Identity.getUrlVariables(new AdobeCallback() { Registers the Identity for Edge Network extension with the Mobile Core extension. +> **Warning** +> Deprecated as of 2.0.0. Use [MobileCore.registerExtensions API](https://github.com/adobe/aepsdk-core-android/blob/main/docs/Usage/MobileCore.md#registering-extensions-and-starting-the-sdk) instead. + > **Note** > If your use-case covers both Edge Network and Adobe Experience Cloud Solutions extensions, you need to register Identity for Edge Network and Identity for Experience Cloud Identity Service from Mobile Core extensions. For more details, see the [frequently asked questions](https://aep-sdks.gitbook.io/docs/foundation-extensions/identity-for-edge-network/identity-faq#q-i-am-using-aep-edge-and-adobe-solutions-extensions-which-identity-extension-should-i-install-and-register). diff --git a/Documentation/getting-started.md b/Documentation/getting-started.md index c3aace0f..a3736e28 100644 --- a/Documentation/getting-started.md +++ b/Documentation/getting-started.md @@ -13,11 +13,12 @@ The Adobe Experience Platform Identity for Edge Network extension has the follow ### Java 1. Add the Mobile Core and Edge extensions to your project using the app's Gradle file. +See the [current version list](https://developer.adobe.com/client-sdks/documentation/current-sdk-versions) for the latest extension versions to use. ```java - implementation 'com.adobe.marketing.mobile:core:1.+' - implementation 'com.adobe.marketing.mobile:edge:1.+' - implementation 'com.adobe.marketing.mobile:edgeidentity:1.+' + implementation 'com.adobe.marketing.mobile:core:2.0.0' + implementation 'com.adobe.marketing.mobile:edge:2.0.0' + implementation 'com.adobe.marketing.mobile:edgeidentity:2.0.0' ``` 2. Import the Mobile Core and Edge extensions in your Application class. @@ -39,22 +40,36 @@ public class MobileApp extends Application { public void onCreate() { super.onCreate(); MobileCore.setApplication(this); - try { - Edge.registerExtension(); - Identity.registerExtension(); - // register other extensions - MobileCore.start(new AdobeCallback () { - @Override - public void call(Object o) { - MobileCore.configureWithAppID("yourAppId"); - } - }); - - } catch (Exception e) { - ... - } - - + + MobileCore.configureWithAppID(ENVIRONMENT_FILE_ID); + + // register Adobe extensions + MobileCore.registerExtensions( + Arrays.asList(Edge.EXTENSION, Identity.EXTENSION, Assurance.EXTENSION), + o -> Log.d("MobileApp", "Mobile SDK was initialized") + ); + } +} +``` +### Kotlin + +```kotlin +class MobileApp : Application() { + // Set up the preferred Environment File ID from your mobile property configured in Data Collection UI + private var ENVIRONMENT_FILE_ID: String = "" + + override fun onCreate() { + super.onCreate() + + // register AEP SDK extensions + MobileCore.setApplication(this) + MobileCore.setLogLevel(LoggingMode.VERBOSE) + + MobileCore.registerExtensions( + listOf(Edge.EXTENSION, Identity.EXTENSION, Consent.EXTENSION, Assurance.EXTENSION) + ) { + MobileCore.configureWithAppID(ENVIRONMENT_FILE_ID) + } } } ``` diff --git a/README.md b/README.md index 2f5f7753..0140814e 100644 --- a/README.md +++ b/README.md @@ -11,12 +11,14 @@ The Adobe Experience Platform Edge Identity is a mobile extension for the [Adobe Integrate the Edge Identity extension into your app by including the following in your gradle file's `dependencies`: ```gradle -implementation 'com.adobe.marketing.mobile:edgeidentity:1.+' -implementation 'com.adobe.marketing.mobile:edge:1.+' -implementation 'com.adobe.marketing.mobile:core:1.+' -implementation 'com.adobe.marketing.mobile:edgeconsent:1.+' // Recommended when using the setAdvertisingIdentifier API +implementation 'com.adobe.marketing.mobile:edgeidentity:2.0.0' +implementation 'com.adobe.marketing.mobile:edge:2.0.0' +implementation 'com.adobe.marketing.mobile:core:2.0.0' +implementation 'com.adobe.marketing.mobile:edgeconsent:2.0.0' // Recommended when using the setAdvertisingIdentifier API ``` +See the [current version list](https://developer.adobe.com/client-sdks/documentation/current-sdk-versions) for the latest extension versions to use. + ### Development **Open the project** @@ -89,12 +91,6 @@ To enable the Git pre-commit hook to apply code formatting on each commit, run t make init ``` -## Related Projects - -| Project | Description | -| ------------------------------------------------------------ | ------------------------------------------------------------ | -| [AEP SDK Sample App for Android](https://github.com/adobe/aepsdk-sample-app-android) | Contains Android sample app for the AEP SDK. | - ## Documentation Additional documentation for usage and SDK architecture can be found under the [Documentation](Documentation) directory. From dba1d57fa4389f116779a223dd772ca95fb0e6e2 Mon Sep 17 00:00:00 2001 From: Calise Cheung Date: Tue, 24 Jan 2023 01:17:03 -0800 Subject: [PATCH 02/16] Update Readme Update Readme --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0140814e..df7b5e87 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,9 @@ To open and run the project, open the `code/settings.gradle` file in Android Stu The test app needs to be configured with the following edge extensions before it can be used: - Mobile Core (installed by default) -- [Edge](https://aep-sdks.gitbook.io/docs/foundation-extensions/experience-platform-extension) -- [Edge Identity](https://aep-sdks.gitbook.io/docs/foundation-extensions/identity-for-edge-network) -- [Edge Consent](https://aep-sdks.gitbook.io/docs/foundation-extensions/consent-for-edge-network) (recommended when using the setAdvertisingIdentifier API) +- [Edge](https://developer.adobe.com/client-sdks/documentation/edge-network) +- [Edge Identity](https://developer.adobe.com/client-sdks/documentation/identity-for-edge-network) +- [Edge Consent](https://developer.adobe.com/client-sdks/documentation/consent-for-edge-network) (recommended when using the setAdvertisingIdentifier API) **Run demo application** @@ -91,6 +91,12 @@ To enable the Git pre-commit hook to apply code formatting on each commit, run t make init ``` +## Related Projects + +| Project | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| [AEP SDK Sample App for Android](https://github.com/adobe/aepsdk-sample-app-android) | Contains Android sample app for the AEP SDK. | + ## Documentation Additional documentation for usage and SDK architecture can be found under the [Documentation](Documentation) directory. From 47399651caa5f3a9b7938a9eab6a158e8aacdea6 Mon Sep 17 00:00:00 2001 From: Calise Cheung Date: Tue, 24 Jan 2023 11:15:35 -0800 Subject: [PATCH 03/16] Use Core MapUtils for isNullOrEmpty Use Core MapUtils for isNullOrEmpty --- .../mobile/edge/identity/IdentityMap.java | 3 ++- .../mobile/edge/identity/IdentityState.java | 3 ++- .../marketing/mobile/edge/identity/Utils.java | 11 ----------- .../mobile/edge/identity/UtilsTests.java | 16 ---------------- 4 files changed, 4 insertions(+), 29 deletions(-) diff --git a/code/edgeidentity/src/main/java/com/adobe/marketing/mobile/edge/identity/IdentityMap.java b/code/edgeidentity/src/main/java/com/adobe/marketing/mobile/edge/identity/IdentityMap.java index 710bbc31..2a5b8c9b 100644 --- a/code/edgeidentity/src/main/java/com/adobe/marketing/mobile/edge/identity/IdentityMap.java +++ b/code/edgeidentity/src/main/java/com/adobe/marketing/mobile/edge/identity/IdentityMap.java @@ -15,6 +15,7 @@ import com.adobe.marketing.mobile.services.Log; import com.adobe.marketing.mobile.util.DataReader; +import com.adobe.marketing.mobile.util.MapUtils; import com.adobe.marketing.mobile.util.StringUtils; import java.util.ArrayList; import java.util.HashMap; @@ -265,7 +266,7 @@ Map asXDMMap(final boolean allowEmpty) { * @return {@code Map} XDM format representation of IdentityMap */ static IdentityMap fromXDMMap(final Map map) { - if (Utils.isNullOrEmpty(map)) { + if (MapUtils.isNullOrEmpty(map)) { return null; } diff --git a/code/edgeidentity/src/main/java/com/adobe/marketing/mobile/edge/identity/IdentityState.java b/code/edgeidentity/src/main/java/com/adobe/marketing/mobile/edge/identity/IdentityState.java index 2cc44e91..eeec0c41 100644 --- a/code/edgeidentity/src/main/java/com/adobe/marketing/mobile/edge/identity/IdentityState.java +++ b/code/edgeidentity/src/main/java/com/adobe/marketing/mobile/edge/identity/IdentityState.java @@ -24,6 +24,7 @@ import com.adobe.marketing.mobile.services.Log; import com.adobe.marketing.mobile.services.ServiceProvider; import com.adobe.marketing.mobile.util.DataReader; +import com.adobe.marketing.mobile.util.MapUtils; import java.util.HashMap; import java.util.Map; @@ -294,7 +295,7 @@ private boolean isIdentityDirectRegistered(final Map eventHubSha null ); - return !Utils.isNullOrEmpty(identityDirectInfo); + return !MapUtils.isNullOrEmpty(identityDirectInfo); } /** diff --git a/code/edgeidentity/src/main/java/com/adobe/marketing/mobile/edge/identity/Utils.java b/code/edgeidentity/src/main/java/com/adobe/marketing/mobile/edge/identity/Utils.java index ebdcfc95..c3d075c9 100644 --- a/code/edgeidentity/src/main/java/com/adobe/marketing/mobile/edge/identity/Utils.java +++ b/code/edgeidentity/src/main/java/com/adobe/marketing/mobile/edge/identity/Utils.java @@ -12,22 +12,11 @@ package com.adobe.marketing.mobile.edge.identity; import java.util.List; -import java.util.Map; class Utils { private Utils() {} - /** - * Checks if the {@code Map} provided is null or empty. - * - * @param map the {@code Map} to verify - * @return true if the {@code Map} provided is null or empty; false otherwise - */ - static boolean isNullOrEmpty(final Map map) { - return map == null || map.isEmpty(); - } - /** * Checks if the {@code List} provided is null or empty. * diff --git a/code/edgeidentity/src/test/java/com/adobe/marketing/mobile/edge/identity/UtilsTests.java b/code/edgeidentity/src/test/java/com/adobe/marketing/mobile/edge/identity/UtilsTests.java index 3a5072b4..eb060e62 100644 --- a/code/edgeidentity/src/test/java/com/adobe/marketing/mobile/edge/identity/UtilsTests.java +++ b/code/edgeidentity/src/test/java/com/adobe/marketing/mobile/edge/identity/UtilsTests.java @@ -17,27 +17,11 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Map; import org.junit.Test; @SuppressWarnings("unchecked") public class UtilsTests { - @Test - public void test_isNullOrEmpty_nullMap() { - assertTrue(Utils.isNullOrEmpty((Map) null)); - } - - @Test - public void test_isNullOrEmpty_emptyMap() { - assertTrue(Utils.isNullOrEmpty(Collections.EMPTY_MAP)); - } - - @Test - public void test_isNullOrEmpty_nonEmptyNonNullMap() { - assertFalse(Utils.isNullOrEmpty(Collections.singletonMap("someKey", "someValue"))); - } - @Test public void test_isNullOrEmpty_nullList() { assertTrue(Utils.isNullOrEmpty((List) null)); From c6214e365774313ee82bb9463338386109139be4 Mon Sep 17 00:00:00 2001 From: Calise Cheung Date: Tue, 24 Jan 2023 16:39:37 -0800 Subject: [PATCH 04/16] Updatet documentation Updatet documentation, make toc for Readme.md. Move advertising-identifier content to its own file. --- Documentation/README.md | 57 ++----------------- Documentation/advertising-identifier.md | 53 +++++++++++++++++ Documentation/api-reference.md | 2 +- README.md | 2 +- .../identity/app/ui/CustomIdentityFragment.kt | 2 +- 5 files changed, 61 insertions(+), 55 deletions(-) create mode 100644 Documentation/advertising-identifier.md diff --git a/Documentation/README.md b/Documentation/README.md index 5967d96f..81afbe6b 100644 --- a/Documentation/README.md +++ b/Documentation/README.md @@ -1,53 +1,6 @@ -# Advertising identifier +# Edge Identity extension documentation -## Configuration -To enable advertising identifier features in the sample app, follow these steps: -1. Update the value for key `gms_ads_app_id` located in the `secrets.xml` at [aepsdk-edgeidentity-android/code/app/src/main/res/values](../code/app/src/main/res/values/secrets.xml) with a valid Google AdMob app ID. - - See Google's [quick start reference](https://developers.google.com/admob/android/quick-start) on how to get your AdMob app ID. See step 3 of the [Configure your app](https://developers.google.com/admob/android/quick-start#import_the_mobile_ads_sdk) section for a free public test app ID from Google. - - Any real key values in the `secrets.xml` file should **not** be committed to the repository. -2. By default, the ad ID features are commented out in the sample app. To enable these features, uncomment the implemention code using [find and replace all](https://www.jetbrains.com/help/idea/finding-and-replacing-text-in-project.html#replace_search_string_in_project) to replace all instances of: -```java -/* Ad ID implementation -``` -with: -```java -//* Ad ID implementation -``` -Each code block has a pair of block comments wrapped around it to enable this behavior: -```java -/* Ad ID implementation (pt. 1/4) - -/* Ad ID implementation (pt. 1/4) */ -``` - -After replacement it will become: -```java -//* Ad ID implementation (pt. 1/4) - -//* Ad ID implementation (pt. 1/4) */ -``` - -For convenience, these are the default find and replace shortcuts in Android Studio: -[Default shortcuts for find and replace](./assets/find-and-replace-shortcuts.png) - -The shortcut should open a window that looks like the following: -[Example of find and replace](./assets/find-and-replace-all-example.png) -There should be 5 pairs of special comment blocks (10 total matches) across two files: -`app/build.gradle`, `CustomIdentityFragment.kt`, and `SharedViewModel.kt` - -3. With the implementation code and gradle files uncommented with new dependencies, sync the project with the Gradle file changes using: File -> Sync Project with Gradle Files - -[Example of find and replace](./assets/sync-project-gradle-example.png) - -The app should now be properly configured to use advertising identifier features. - -To **disable** these features, follow these steps: -1. [Find and replace](https://www.jetbrains.com/help/idea/finding-and-replacing-text-in-project.html#replace_search_string_in_project) all instances of: -```java -//* Ad ID implementation -``` -with: -```java -/* Ad ID implementation -``` -2. Sync Project with Gradle files using: File -> Sync Project with Gradle Files \ No newline at end of file +## Contents +- [Getting started](getting-started.md) +- [API reference](api-reference.md) +- [Getting started test app](getting-started-test-app.md) \ No newline at end of file diff --git a/Documentation/advertising-identifier.md b/Documentation/advertising-identifier.md new file mode 100644 index 00000000..5967d96f --- /dev/null +++ b/Documentation/advertising-identifier.md @@ -0,0 +1,53 @@ +# Advertising identifier + +## Configuration +To enable advertising identifier features in the sample app, follow these steps: +1. Update the value for key `gms_ads_app_id` located in the `secrets.xml` at [aepsdk-edgeidentity-android/code/app/src/main/res/values](../code/app/src/main/res/values/secrets.xml) with a valid Google AdMob app ID. + - See Google's [quick start reference](https://developers.google.com/admob/android/quick-start) on how to get your AdMob app ID. See step 3 of the [Configure your app](https://developers.google.com/admob/android/quick-start#import_the_mobile_ads_sdk) section for a free public test app ID from Google. + - Any real key values in the `secrets.xml` file should **not** be committed to the repository. +2. By default, the ad ID features are commented out in the sample app. To enable these features, uncomment the implemention code using [find and replace all](https://www.jetbrains.com/help/idea/finding-and-replacing-text-in-project.html#replace_search_string_in_project) to replace all instances of: +```java +/* Ad ID implementation +``` +with: +```java +//* Ad ID implementation +``` +Each code block has a pair of block comments wrapped around it to enable this behavior: +```java +/* Ad ID implementation (pt. 1/4) + +/* Ad ID implementation (pt. 1/4) */ +``` + +After replacement it will become: +```java +//* Ad ID implementation (pt. 1/4) + +//* Ad ID implementation (pt. 1/4) */ +``` + +For convenience, these are the default find and replace shortcuts in Android Studio: +[Default shortcuts for find and replace](./assets/find-and-replace-shortcuts.png) + +The shortcut should open a window that looks like the following: +[Example of find and replace](./assets/find-and-replace-all-example.png) +There should be 5 pairs of special comment blocks (10 total matches) across two files: +`app/build.gradle`, `CustomIdentityFragment.kt`, and `SharedViewModel.kt` + +3. With the implementation code and gradle files uncommented with new dependencies, sync the project with the Gradle file changes using: File -> Sync Project with Gradle Files + +[Example of find and replace](./assets/sync-project-gradle-example.png) + +The app should now be properly configured to use advertising identifier features. + +To **disable** these features, follow these steps: +1. [Find and replace](https://www.jetbrains.com/help/idea/finding-and-replacing-text-in-project.html#replace_search_string_in_project) all instances of: +```java +//* Ad ID implementation +``` +with: +```java +/* Ad ID implementation +``` +2. Sync Project with Gradle files using: File -> Sync Project with Gradle Files \ No newline at end of file diff --git a/Documentation/api-reference.md b/Documentation/api-reference.md index d8f4c5d4..7fa6090b 100644 --- a/Documentation/api-reference.md +++ b/Documentation/api-reference.md @@ -135,7 +135,7 @@ Identity.getUrlVariables(new AdobeCallback() { Registers the Identity for Edge Network extension with the Mobile Core extension. > **Warning** -> Deprecated as of 2.0.0. Use [MobileCore.registerExtensions API](https://github.com/adobe/aepsdk-core-android/blob/main/docs/Usage/MobileCore.md#registering-extensions-and-starting-the-sdk) instead. +> Deprecated as of 2.0.0. Use the [MobileCore.registerExtensions API](https://developer.adobe.com/client-sdks/documentation/mobile-core/api-reference) instead. > **Note** > If your use-case covers both Edge Network and Adobe Experience Cloud Solutions extensions, you need to register Identity for Edge Network and Identity for Experience Cloud Identity Service from Mobile Core extensions. For more details, see the [frequently asked questions](https://aep-sdks.gitbook.io/docs/foundation-extensions/identity-for-edge-network/identity-faq#q-i-am-using-aep-edge-and-adobe-solutions-extensions-which-identity-extension-should-i-install-and-register). diff --git a/README.md b/README.md index df7b5e87..5dd127ff 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ The test app needs to be configured with the following edge extensions before it 2. Select the `app` runnable with the desired emulator and run the program. > **Note** -> To enable GAID related advertising identifier features, follow the [documentation](Documentation/README.md#advertising-identifier) for the required setup steps. +> To enable GAID related advertising identifier features, follow the [documentation](Documentation/advertising-identifier.md) for the required setup steps. **View the platform events with Assurance** diff --git a/code/app/src/main/java/com/adobe/marketing/edge/identity/app/ui/CustomIdentityFragment.kt b/code/app/src/main/java/com/adobe/marketing/edge/identity/app/ui/CustomIdentityFragment.kt index b651095f..7091c831 100644 --- a/code/app/src/main/java/com/adobe/marketing/edge/identity/app/ui/CustomIdentityFragment.kt +++ b/code/app/src/main/java/com/adobe/marketing/edge/identity/app/ui/CustomIdentityFragment.kt @@ -123,7 +123,7 @@ class CustomIdentityFragment : Fragment() { // Default hint for how to enable ad ID features; overwritten by actual implementation when ad ID features are enabled. root.findViewById