Before the words:
I am honored to share with you the technical realization of the Hongmeng version of "You Draw I Guess" on the New Year's Eve. Everyone is very enthusiastic. Of course, the large number of gifts arranged by our 51CTO is also super awesome! Because my work is usually busy, Mr. Zhang and I’s live broadcast arrangements are basically driven by 51CTO’s live broadcast executive teachers. In the meantime, I am very grateful to 51CTO’s Mr. Wang, and I admire Mr. Wang’s execution ability! Until the first few hours before the live broadcast, Teacher Zhang Zhibin and I were even perfecting the process of drawing and guessing.
Positive article:
The content of this live broadcast is mainly based on the previously written "10-Minute Hongmeng Application Development: Hongmeng Hand-painted Board" for transformation, which adds Hongmeng's characteristic networking capabilities. The structure diagram is as follows (this one was also drawn during the live broadcast):
Based on Hongmeng's circulation ability to realize the "I guess" function you draw and guess, several points that need to be paid attention to:
- Permission declaration in config.json
- Initiate a permission request in Ability, so that the application will pop up a permission request dialog box when it needs permission (when the request is initiated).
- Where Hongmeng cross-device transfer capabilities are needed, implement the IAbilityContinuation interface.
- Two networked devices need to be in the same network.
- In the phone's settings-application-permission management-permissions-other permissions-multi-device collaboration, enable device collaboration. If you click Deny in the dialog box in step 2, you can open it here.
There are two important points in implementing the IAbilityContiunation interface:
- The onSaveData() function, in this function, save the data state.
- The onRestoreData() function, in this function, performs data recovery operations.
Flower Xu
In addition to ppt, we also prepared other props for the live broadcast, such as a self-made "prompter board", the answer entry you draw my guess, and a whiteboard to help explain.
Then there are friends who are curious:
Haha, let's not go into the topic of hair. A suggestion to every novice technical person: Don't rely on yourself to solve technical problems that cannot be solved, learn to use resources to solve them, otherwise you will easily get gray hair.
Then some classmates were curious about my row of mobile phones, which are actually test machines that I usually use for development, both Android and Apple, and now there are Hongmeng ones. In the lower right corner is a customized version of the power bank sent by 51CTO~
Source code
Finally, the source code link is provided: https://gitee.com/doufx/draw-and-guess
Finally, I wish you all great luck in the Year of the Ox, good health and prosperous wealth! !
Original link: https://harmonyos.51cto.com/posts/3111#bkwz
To learn more about Hongmeng, please visit:
Hongmeng technology community built by 51CTO and Huawei official strategic cooperation
https://harmonyos.51cto.com/#bkwz