Huawei App Messaging Service Part2
*Now, you need to set sending time parameters like started and ended time also trigger event time
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
*Ignore the conversion event configuration. Now, click Save in the upper side to save the configurations.
Developing App Messaging
We can create a layout for the main page using the code below.
("https://gist.githubusercontent.com/hakki2391/78cdd988dae0ffc6910aa0a257d47790/raw/d8e45fbd33f8be1050d456393f015dd6708b3bdc/xml")
Then, we need to initialize the AGConnectAppMessaging instance using the lines below.
("https://gist.githubusercontent.com/hakki2391/83a44247a75ab4cdec5d38d53860aa28/raw/355e5fbc64fb4fc4a0812d2945edf3ae3a26e2fc/AGConnectAppMessaging")
We need to obtain the device AAID and generate it in the TextView of the project for subsequent testing using code part below.
("https://gist.githubusercontent.com/hakki2391/97b9cb489a3030443f53b5a45b69e321/raw/7a4383cfb72d0816ed6908000c69648ff65092a4/AAID")
On this point, we need to set the flag for forcibly requesting message data from the AppGallery Connect server so that data can be obtained in real time during testing.
("https://gist.githubusercontent.com/hakki2391/8efa94934b1613f9c082b68b6a0d498b/raw/2f150abbb558465f8f801a82f553a7384ef9bc76/gistfile1.txt")
Now, we need to set the pop-up message layout. Different messages are displayed for the tap and closing events.
("https://gist.githubusercontent.com/hakki2391/a2f463f7f3d3b16304fdc581032f5cd7/raw/a3ca27c60a7eb192a10627466b8aeebf565057ef/gistfile1.txt")
Then we will set the button tap event for applying the custom layout.
("https://gist.githubusercontent.com/hakki2391/309ad98ffa22942b53ed5d6cfae14dec/raw/8a9b969313dcbdb470f0a9a45f522e268e78593f/gistfile1.txt")
Now, we will set the button tap event for canceling the custom layout.
("https://gist.githubusercontent.com/hakki2391/0cbc31fb868c05fc5631742d7f983da1/raw/ec1ecb2be2759e3fda7d4419e4e9d7b1d1d2db6e/gistfile1.txt")
In this point, we can customize the layout like below.
("https://gist.githubusercontent.com/hakki2391/c4502ad5e80338bca3f85510463977bf/raw/28f72e53ceeaa0efe40f2781cea506821ac920ba/gistfile1.txt")
Finally, we can customize the layout file, inherit the AGConnectMessagingDisplay class, and rewrite the displayMessage method to display the layout.
("https://gist.githubusercontent.com/hakki2391/32a1ba37a0b092faf7a7923ec1044d72/raw/9bcc53cedda0419187ec58cd45fe1b517b9678e8/gistfile1.txt")
Lets test the App Messaging Demo
When we run the demo app, we will see the screen below.
After that we will select the created message from the message list in the AppGallery Connect and click Test.
Now, we need to click Add test user on the screen.
On this point, we will enter the AAID of the test mobile phone and save test.
If we want to use custom layout, we need to click on Set Custom View in the test mobile phone’s application. We have to repeat steps 3 and 4 and click Save to reset the test mobile phone. Switch the app to the background and then to the foreground after at least a second. The message in custom layout is now displayed.
If we want to restore the custom layout to the default layout, we must click Close Custom View and reset the test cell phone. Now we should switch the app to the background and then to the foreground after at least a second. The default layout is displayed.
Sample Code for APK
We can find the sample apk code using the link below. We can understand how to use App Messaging clearly.
("https://developer.huawei.com/consumer/en/codelab/AppMessaging/index.html#10")
FAQs
We may find FAQs about App Messaging on the link below.
("https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-appmessage-faq")
Thank you for taking your time and reading my article. Hope to see you in my next forum.xda article.
Related
Note : I'm just sharing the work of the XDA Member slackydroid.This app was tested on this device and it was working fine.Here's a little introduction by him :
slackydroid said:
Phonechievements is back
Phonechievements (latest version 1.35)
About
Phonechievements brings achievements to the mobile phone. For those who are gamers the concept isn't new, for those who are not, achievements are just rewards you get for accomplishing a goal. You don't get an actual prize, it's just a form of reward that you get in writing. Moreover, this app allows you to brag on Facebook with them (for now).
Open the app and navigate through the list. Each achievement has a description on how you can unlock it. Want to let everyone know how you master the phone? Share on Facebook the unlocked achievements. Just open the app and go to the achievement and a Facebook logo button will allow you to do that.
With each update new features and of course new phonechievements will be added.
If you like the idea and want to help me improve or have any suggestions for new achievements, please check it out.
The app is available for Android 2.0+. If you find any issues please let me know so I can fix them.
Thank you.
Screenshots
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Download
Google Play Download Link
Current Features
More than 70 unlockable achievements in 6 categories (more to come)
Share unlocked achievements on Facebook, Twitter or Google Plus
Show/hide unlocked achievements
Statusbar notification on phonechievement unlocked
Possibility to hide individual achievements
Option to switch GPS query ON/OFF (if you keep GPS on from android settings the you most probably want tot keep it OFF in the app)
Sync your profile online (check what you have synced on http://phonechievements.com/profile/yourchosennickname/) - for now an ugly 10 minutes of code website will appear. The nice one is under construction. This is just for checking purposes
Share online profile with most of the sharing apps installed
Profile forum signature:
E.g.:
Code:
[PLAIN][URL="http://phonechievements.com/profile/Nightfly89/"][IMG]http://phonechievements.com/profile/Nightfly89/sign/[/IMG][/URL][/PLAIN]
Social
Follow on Facebook
IMPORTANT
IT IS RECOMMENDED THAT YOU ALWAYS USE THE SYNC OPTION BEFORE DOING AN UPDATE AND ALSO ON A REGULAR BASIS. AFTER YOU UPDATED THE APP IF YOU EXPERIENCE LOSS OF STATS OR ACHIEVEMENTS USE THE SYNC OPTION AGAIN TO RECOVER THEM FROM THE SYNC SERVER
Click to expand...
Click to collapse
Original Thread - http://forum.xda-developers.com/showthread.php?t=2097994
Huawei's feature-packed EMUI 5.1 system comes with a number of handy shortcuts that give you quick access to frequently used features and menu options. This tutorial provides a brief introduction to three useful time-saving features.
1. Searching for Menu Options
The global search feature allows you to search for menu options directly from the home screen. For example, when you want to set up a portable hotspot, you can access the portable hotspot settings directly from the search results, you do not need to go to the settings menu.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
To access the global search feature, swipe down on the home screen and enter the keyword you want to search for. Matching results will then be displayed beneath the search box.
2. Blocking Notifications
To block notifications, you can go to Settings > Notification & status bar > Notifications management, and choose the app you want to block the notifications from. However, it can be a time-consuming process, especially if you have installed a large number of apps.
Now you can block notifications from an app directly from the notification panel. Simply swipe down from the notification bar at the top of the screen, touch and hold the notification from the app that you want to block, and then select Block all from this app.
3. Accessing the Shortcuts Panel from the Lock Screen
To make an NFC payment, you can go to Settings > More > Near Field Communication (NFC) to enable this feature. However, the shortcuts panel allows you to quickly enable and disable NFC and other frequently used features such as Wi-Fi, mobile data, Bluetooth, and Airplane mode. The shortcuts panel can be accessed directly from the lock screen, simply swipe down from the top of the screen and touch the desired shortcut.
I read out your post thanks for sharing such a great information about the features for Your Huawei Smartphone. I think this information is very helpful for every one .Overall fantastic features .If you have any other information please share .
The Global search is probably my favorite EMUI feature. It saves so much time and I use it for almost everything.
1. Development Scenario
Location update
If your app needs to request the device location continuously, you can apply for the location permission for your app, call the requestLocationUpdates() API of Location Kit, set different request parameters (in LocationRequest), and specify a location mode as needed. To cancel location information callback, call the removeLocationUpdates() API.
Location semantics
If your app needs to obtain both the location information and its address information, you can set isNeedAddress in LocationRequest to true, specify a language and country code, and then call the requestLocationUpdates() API.
Activity identification
If your app needs to obtain the activity status of the user's device (for example, walking, running, or bicycling) or your app needs to detect activity status change of a user, you can apply for the activity identification permission for your app and call the createActivityIdentificationUpdates() API. To cancel activity identification update, call the deleteActivityIdentificationUpdates() API. If you want to detect user activity status change, call the createActivityConversionUpdates() API to listen on activity status changes of the current device. To cancel listening on activity status changes, call the deleteActivityConversionUpdates() API.
Geofence
If you are interested in a place, you can call the createGeofenceList() API to create a geofence based on the place. Then, Location Kit can sense the distance between the current device location and the geofence. When the device enters the geofence, a notification will be sent to your app. In addition, Location Kit can detect the duration during which the device stays in the geofence, and send a notification to your app if the duration reaches a specified value.
2. Development Process
The following figure shows the overall development process. The detailed development procedures are described in the following sections. If you have an app with third-party mobile services integrated, you can use HMS Convertor to automatically convert APIs of the third-party mobile services into HMS-based APIs, achieving quick integration of HMS services. To learn more about HMS Convertor, click here.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Symptom
A user is redirected by a deep link with parameters to the home page of a quick app. The launch mode of the home page is set to singleTask. When the quick app receives parameters carried by the deep link, the following situation occurs:
l If the quick app has not been opened, the quick app can receive the parameters properly.
l After a user is redirected to the target page in the quick app for the first time, the user presses the home button to switch the quick app to the background. Then the user is redirected to the home page of the same quick app by another deep link with different parameters. The home page fails to receive parameters of the deep link. Logs show that the onRefresh lifecycle function is triggered on the home page, but the log information of the onRefresh lifecycle function indicates that the parameters of the previous deep link are used.
The code where the exception occurs is as follows:
Deep link opened first:
hap://app/com.huawei.text?test=first
Deep link opened later:
hap://app/com.huawei.text?test=secon
Code for going to the home page of the quick app:
The parameters received when two deep links open the home page of the quick app are as follows:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Cause Analysis
The user is redirected to the quick app that has been opened through a deep link. The redirection triggers the onRefresh lifecycle function of the page to receive parameters in the deep link. However, it is incorrectly considered that the parameters received in the onRefresh function are the same as those received when the quick app is opened for the first time. That is, the parameters are received in this.xxx format. Actually, the onRefresh lifecycle function contains parameters, which need to be obtained.
Solution
The parameters of the onRefresh lifecycle function are in the data of onRefresh(data) and need to be obtained in the data.xxx format. The correct sample code is as follows:
The following figure shows the effect when parameters are correctly obtained.
For more details, you can go to:
Our official website: https://developer.huawei.com/consumer/en/hms?ha_source=hms1
Our Development Documentation page, to find the documents you need: https://developer.huawei.com/consumer/en/doc/development?ha_source=hms1
Reddit to join our developer discussion: https://www.reddit.com/r/HuaweiDevelopers/
GitHub to download demos and sample codes: https://github.com/HMS-Core
Stack Overflow to solve any integration problems: https://stackoverflow.com/questions/tagged/huawei-mobile-services?tab=Newest
For code, you can check https://forums.developer.huawei.com/forumPortal/en/topic/0203445081228700074
SymptomMy game was rejected because the floating window is unable to be hidden in certain game modules after being dragged to the top of the screen. However, this function is normal on the game’s home page.
Test Model and SDK Version
Phone model: Huawei phones running EMUI 9.1.1 or earlier
SDK version number: 5.0.4.303
ReproductionThe floating window can be properly displayed and hidden on the game’s home page. On the page on which the exception occurs, I dragged the floating window to the corresponding position. A Hide balloons pop-up was displayed and the floating window did not display. I then tapped HIDE. The Hide balloons pop-up closed, but the floating window remained there.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
AnalysisAfter analyzing the code logic, I found that the game’s home page and the page (a mini-game module) where the exception occurred are the main process and its sub-process, respectively. In each process, the SDK has been initialized and integrated with the floating window API by referring to the official document.
In the mini game, drag the floating window to the hiding position, and the Hide balloons pop-up will display. In this case, the onPause method is called to hide the floating window behind the pop-up. After the user taps the hide button to close the pop-up, the game page will display again. The BuoyClient.showFloatWindow API is called to display the floating window again. This may confuse the user.
In conclusion, my operations were all correct, so the problem may have been by compatibility issues with the floating window of the Game Service SDK in multi-process games.
Based on the preceding analysis, I tried the following solution: To display or hide the floating window, use the sub-process to communicate with the main process and call the APIs for displaying and hiding the floating window. However, the problem was not resolved.
SolutionI submitted a ticket to Huawei technical support and they provided me with the following solution:
Add the following statement in red to the manifest file.
XML:
<activity
android:multiprocess="true"
android:theme="@style/Theme.Translucent"
android:name="com.huawei.appmarket.component.buoycircle.impl.delegete.BuoyBridgeActivity"
android:exported="false"
android:excludeFromRecents="true"
android:configChanges="locale|orientation|screenSize|layoutDirection|fontScale"
android:hardwareAccelerated="true"/>
I packaged my game and performed another test. This time, the problem was resolved.
According to Huawei technical support, we don’t need to manually complete the statement, as the SDK has declared it for us. But if our game is a multi-process one, the statement needs to be overwritten, and the configuration in red needs to be added. The configuration decides whether to allow instantiation in the calling process. The value true indicates yes, and the default value is false.