Expert: Integration of HMS Core Kits in MVVM and RxAndroid based Android App (A/B Testing) Part-8
Overview
In this article, I will create a Movie Show android application in which I will integrate HMS Core kits such as Huawei ID, Analytics, Huawei Ads, Remote Configuration, DTM, Cloud Testing and A/B Testing.
In this article, I will integrate A/B Testing.
In this series of article, I will cover all the kits with real life usages in Movie Show application. This is the part-8 article of this series.
Part-1: https://forums.developer.huawei.com/forumPortal/en/topic/0202684555189490078?fid=0101187876626530001
Part-2: https://forums.developer.huawei.com/forumPortal/en/topic/0201690592255120129?fid=0101187876626530001
Part-3: https://forums.developer.huawei.com/forumPortal/en/topic/0201690596679190130?fid=0101188387844930001
Part-4: https://forums.developer.huawei.com/forumPortal/en/topic/0202695893785380004
Part-5: https://forums.developer.huawei.com/forumPortal/en/topic/0202695893785380004\
Part-6: https://forums.developer.huawei.com/forumPortal/en/topic/0202703550492730065
Part-7: https://forums.developer.huawei.com/forumPortal/en/topic/0202703557045220066?fid=0101188387844930001
Prerequisite
- A computer (desktop or laptop)
- A Huawei phone EMUI 9.0, which is used to experiment A/B Testing.
- Android SDK applicable to devices using Android API-Level 19 (Android 4.4 KitKat) or higher.
- An account on AppGallery Connect which has at least one project.
What is A/B Testing?
A/B testing is a user experience research methodology. A/B tests consist of a randomized experiment with two variants, A and B. It includes application of statistical hypothesis testing or “two-sample hypothesis testing” as used in the field of statistics.
Huawei A/B Testing
A/B Testing provides a collection of refined operation tools to optimize app experience and improve key conversion and growth indicators. You can use the service to create one or more A/B tests engaging different user groups to compare your variants of app UI design, copywriting, product functions, or marketing activities for performance metrics and find the best one that meets user requirements.
App Gallery Integration process
- Sign In and Create or Choose a project on AppGallery Connect portal.
- Navigate to Project settings > download the configuration file.
- Navigate to General Information > Data Storage location
- Navigate to Growing > A/B Testing > Enable now.
Creating a Notifications Experiment
To send notifications to existing users or send new marketing notifications, but you are not sure about the effect, you can use A/B Testing to create a notifications experiment and test treatment groups in the selected user group, to find the optimal notification copywriting and display mode.
We need to access HUAWEI Analytics Kit to obtain the target experiment users and experiment data, and generate experiment reports.
- For details about how to enable HUAWEI Analytics Kit, please refer to Service Enabling.
- Add the following code to the build.gradle file in the app directory (usually app/build.gradle) to integrate HUAWEI Analytics Kit:
implementation ‘com.huawei.hms:hianalytics:5.0.3.300’ - Notifications experiments depend on HUAWEI Push Kit. To create a notifications experiment, your app needs to access HUAWEI Push Kit.
Testing Procedure
- On the A/B Testing configuration page, click Create notifications experiment.
- Add Basic Information and click Next.
- On the Target users page, set the filter conditions and percentage of test users.
- On the Treatment & control groups page, set parameters such as Notification title, Notification content, Notification action, and App screen in the Set control group and Set treatment group areas. After the setting is complete, click Next.
- On the Track indicators page, select the Main and Optional indicators to be tracked and click Next.
- On the Message options page, set Push time, Validity period, and Importance. The Channel ID parameter is optional. Click Save.
- In the preceding information, Channel ID indicates the notification channel ID provided in the Android O version. If you do not set this parameter, the system uses the value of channel_id set in HUAWEI Push Kit by default. You can also customize the channel ID that can contain a maximum of 255 characters.
Testing an Experiment
We need to test the experiment to ensure that each treatment group can be successfully sent to test users.
- Navigate to the A/B Testing configuration page and find the experiment to be tested in the experiment management list.
- Click Test in the Operation column.
- Click Add test user in the upper right corner, enter the test user AAID, select a treatment group, and click Save.
Note: You can obtain AAID using the following method, run in project and print in log.
private void generateAAID() { HmsInstanceId inst = HmsInstanceId.getInstance(getActivity()); Task<AAIDResult> idResult = inst.getAAID(); idResult.addOnSuccessListener(new OnSuccessListener<AAIDResult>() { @Override public void onSuccess(AAIDResult aaidResult) { String aaid = aaidResult.getId(); Log.d(TAG, "getAAID success:" + aaid); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(Exception e) { Log.d(TAG, "getAAID failure:" + e); } }); }
Releasing a Notifications Experiment
We can release a running notifications experiment whose user percentage is less than 100%. A finished notifications experiment cannot be released.
- Navigate to the A/B Testing configuration page and find the experiment to be released in the experiment management list.
- Click Release in the Operation column
App Build Result
Tips and Tricks
HMS Core Push SDK needs to be integrated, and the push token needs to be applied for on the device.
For remote configuration experiments, the Remote Configuration SDK needs to be integrated. After cloud configuration data is fetched by the device, you need to define and execute the corresponding logic on the app side.
In addition, you need to integrate the HMS Core Analytics SDK to obtain the target experiment users and experiment data, and generate experiment reports.
Conclusion
In this Article, We have learned how to test our application using Huawei A/B Testing for better understand ability of users behaviour in the app, and how to improve users experience.
Thanks for reading this article. Be sure to like and comment to this article, if you found it helpful. It means a lot to me.
References