You can use App Messaging of AppGallery Connect to send relevant messages to target users actively using your app to encourage them to use key app functions. For example, you can send in-app messages to encourage users to subscribe to certain products, provide hints to a game level, or recommend promotions of a restaurant. App Messaging even allows you to customize how your messages look and the way they will be sent, and define events for triggering message sending to your users at the right moment.
What You Will Create
In this codelab, you will build an app that integrates App Messaging and is able to display messages in different languages created in AppGallery Connect based on the system language.
What You Will Learn
Integrate App Messaging.
Create and configure messages in different languages in AppGallery Connect.
Click your project card, and select your app to enable App Messaging from the drop-down list on the top.
Go to Grow > App Messaging and click Use now.
Download the agconnect-services.json file again.
Go to Grow > App Messaging.
Click New.
Set Name and Description.
Set the style and content. In this codelab, set Layout to Banner and other parameters as required. Click Next.
Set target users, set the condition as sending messages by app, and select the package name of the current app.
Add a Language condition and select the first language in which you want messages to be displayed in the app. The following uses simplified Chinese as an example.
Set the sending time as follows. The settings mean that the message will be displayed when your app runs in the foreground or is launched.
Ignore conversion event settings, and click Publish in the upper right corner to publish the message.
Repeat the previous steps to create another message in English. Set other parameters as required for this message in English.
No special layout is required for the codelab. Use the default layout.
Run the Android Studio project to generate an APK and install the APK on the test mobile phone.
Set the device language to simplified Chinese, and launch the app. The message in simplified Chinese will be displayed.
Change the device language to English, and launch the app again. The message in English will be displayed accordingly.
Well done. You have successfully built an app that integrates App Messaging of AppGallery Connect and learned how to integrate the App Messaging SDK and create new messages in AppGallery Connect.