Development Guides for Integrating the HUAWEI OneHop Kit 1 - Huawei Developers

You've likely already read the Preparations for Integrating the HUAWEI OneHop Kit 1, and have made all of the necessary preparations to integrate the HUAWEI OneHop Kit to your app. Thus, this article directly addresses the process of integrating the kit.
Via HUAWEI OneHop, app developers can enable app data and status synchronization between devices, such as editing a document synced from a smartphone on a tablet.
1. Cross-device App Synchronization Procedure
Cross-device app synchronization involves the integration and adaptation of the apps on the mobile phone and the tablet. Currently, only supported on the Huawei smartphones and tablets.
Smartphone apps: As the service initiator and data source, the phone app is responsible for sending the data to be synced, such as the video link and progress.
Tablet apps: As the service succeeding end, the tablet app receives the data and service status synced from the mobile phone.
The following figure shows the overall process.
{
"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"
}
The app integration process on the smartphone is as follows:
Preparation: Ensure that the app on the smartphone is running in the foreground to trigger the HUAWEI OneHop service.
Event listening: The app registers the OneHop listening API with the system and starts the OneHop event listening.
Event processing: After detecting the tapping action of the user, the system notifies the app of the tapping event using the callback function.
Data synchronization: The app on the mobile phone syncs data to the app on the tablet.
The app integration process on the tablet is as follows:
Preparation: The app on the tablet is not required to run in the foreground. After receiving the data synced from the mobile phone, the tablet system automatically starts the corresponding app. If the app is not installed on the tablet, the system will prompt the user to go to HUAWEI AppGallery to download it.
Event listening: The app registers the OneHop listening API with the system and starts the OneHop event listening.
Data receiving: The system transfers the data synced from the mobile phone to the app using the callback function. In this case, the developer needs to parse the data and sync the app status from the mobile phone.
2. API Description
Development Package Description
OneHop Kit and the HwOneHopSDK class used to implement the APIs, are contained in a JAR package. The member functions of the HwOneHopSDK class can be invoked by certain apps.
Class Description
For more information on obtaining authorization and API descriptions, please click on the following link: https://developer.huawei.com/consumer/en/doc/development/connectivity-Guides/OneHop--guide

Related

Development Guides for Integrating the HUAWEI OneHop Kit 1

You've likely already read the Preparations for Integrating the HUAWEI OneHop Kit 1, and have made all of the necessary preparations to integrate the HUAWEI OneHop Kit to your app. Thus, this article directly addresses the process of integrating the kit.
Via HUAWEI OneHop, app developers can enable app data and status synchronization between devices, such as editing a document synced from a smartphone on a tablet.
1. Cross-device App Synchronization Procedure
Cross-device app synchronization involves the integration and adaptation of the apps on the mobile phone and the tablet. Currently, only supported on the Huawei smartphones and tablets.
Smartphone apps: As the service initiator and data source, the phone app is responsible for sending the data to be synced, such as the video link and progress.
Tablet apps: As the service succeeding end, the tablet app receives the data and service status synced from the mobile phone.
The following figure shows the overall process.
{
"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"
}
The app integration process on the smartphone is as follows:
Preparation: Ensure that the app on the smartphone is running in the foreground to trigger the HUAWEI OneHop service.
Event listening: The app registers the OneHop listening API with the system and starts the OneHop event listening.
Event processing: After detecting the tapping action of the user, the system notifies the app of the tapping event using the callback function.
Data synchronization: The app on the mobile phone syncs data to the app on the tablet.
The app integration process on the tablet is as follows:
Preparation: The app on the tablet is not required to run in the foreground. After receiving the data synced from the mobile phone, the tablet system automatically starts the corresponding app. If the app is not installed on the tablet, the system will prompt the user to go to HUAWEI AppGallery to download it.
Event listening: The app registers the OneHop listening API with the system and starts the OneHop event listening.
Data receiving: The system transfers the data synced from the mobile phone to the app using the callback function. In this case, the developer needs to parse the data and sync the app status from the mobile phone.
2. API Description
Development Package Description
OneHop Kit and the HwOneHopSDK class used to implement the APIs, are contained in a JAR package. The member functions of the HwOneHopSDK class can be invoked by certain apps.
Class Description
For more information on obtaining authorization and API descriptions, please click on the following link: https://developer.huawei.com/consumer/en/doc/development/connectivity-Guides/OneHop--guide

DTM Helps You Establish Your Analytics System

During product operations, your operations personnel may want to perform in-depth event tracking of every stage of a marketing activity or service function, in order to gain insights into user behavior during such activities or services. However, modifying code to track a large number of events poses unique challenges to app or website operations, as well as having potential negative impacts on user experience. As services change, your operations personnel will also need to continuously optimize the event tracking. To do this, they will need to regularly submit requirements for modifying tracking code to the product's development personnel, which can be an inefficient and time-consuming process.
Is there a way to make event tracking easier for operations personnel?
HUAWEI Dynamic Tag Manager (DTM) offers such a way. DTM supports visual event tracking, which allows you to track events quickly without the need to write new code.
Take an e-commerce app as an example. With DTM, you can add tracking events for each button on the product details screen, as shown in the figure below.
{
"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"
}
DTM allows you to track events for both Android apps and websites. The figure below shows the page for adding tracking events for a website.
With DTM's visual event tracking feature, you can considerably reduce the workload of your operations and development personnel, freeing them up to perform other tasks. Tracked events will be reported to HUAWEI Analytics which can generate dozens of types of analysis reports, offering you comprehensive insights into users and helping you refine your operations.
In addition, DTM can collectively manage your tags, and allows you to report data to different analytics platforms to perform various kinds of analysis.
Currently, DTM provides zero barriers to entry enterprise-level support, enabling you to enjoy high-quality services without financial investment.
How to Integrate DTM?
To learn more about DTM, visit HUAWEI Developers.
For details about how to integrate the DTM SDK, read the following guides:
Android app integration guide
Web app integration guide

Development Guide for Integrating the HUAWEI OneHop Kit 2

HUAWEI OneHop is a core part of Huawei's device distributed technology. It augments traditional NFC technology with additional short-distance technologies to enable efficient collaboration between smartphones and other devices with a single tap. There are a few things that you should know when integrating HUAWEI OneHop Kit:
Steps for Developing Cross-device Shortcuts
You can trigger OneHop shortcuts by doing the following:
(1) Select the device type.
(2) Select a OneHop shortcut that is supported by the device.
(3) On the device, download and integrate the OneHop development package.
(4) Check that the NFC works properly.
(5) Test and complete the certification.
Steps for Integrating the HUAWEI OneHop Kit to Printers
The diagram below shows the full integration process.
{
"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"
}
The app on the device invokes OneHop Kit to enable Wi-Fi P2P GO mode and write the Wi-Fi data into the NFC tag. During this step, the app on the printer needs to invoke the APIs to initialize and enable the OneHop service.
Users select the file they want to transfer from their phone, then tap the phone against the NFC tag on the device.
The phone obtains the Wi-Fi connection data and establishes a connection with the device.
The phone sends an image transfer notification to the OneHop Kit integrated on the device. The OneHop Kit receives the notification, then sends this notification to the app on the device to prompt the user to start transferring files.
The user accepts, and the phone sends the file to the device. The device then sends a notification to the app on the device to proceed to the next step. Once the app on the device has received the notification, it starts the printing process.
Note
To enable OneHop Kit to read and write NFC tags, the app on the device must have the corresponding driver APIs it needs to use OneHop. For details, refer to the documentation on driver_adapt.h in API Description.
There are two possible exceptions which may occur during the process. (1) The Wi-Fi-P2P connection disconnects unexpectedly during the transfer; (2) No action is taken within 60 seconds and the OneHop Kit sends a service termination value to the app on the device via a status modification callback to stop the OneHop service.
For details about API definitions, refer to the API Description.
Code Sample
This is how the OneHop demo program invokes APIs to initiate OneHop printing:
Note: For details about codes, refer to Sample Code for integrating OneHop for Linux devices. For details about API descriptions, refer to API for integrating OneHop for Linux devices
NFC Tag Handling and Data Parsing
NFC tag handling: App developers do not need to do this. NFC tags are programmed and attached by hardware vendors and distributed using hardware devices.
Data format parsing: App developers do not need to do this. The system automatically parses the OneHop data in the NFC tag and triggers the corresponding operation procedure.

How to Secure Mobile Wallet Account? iCard Integrates the SysIntegrity API to Prevent Risks from Login Step

Overview
iCard is a popular mobile wallet app in Bulgaria. Backed by over 12 years of industry experience and a large user base, iCard provides services such as bank card management, collection and payment, international transfers, and foreign currency exchange for more than 30 countries and regions in Europe. How to ensure user account and transaction security and prevent itself from being attacked on risky devices have always been the key challenges of iCard.
{
"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"
}
Challenges
Risky devices undoubtedly affect app systems and users alike. Martin Dimitrov, head of mobile development team in iCard, said, "Jailbreak and root processes essentially alter the operating system and its security level. The more change that the operating system tolerates, the greater the likelihood that a legitimate app will be vulnerable after a device is jailbroken or rooted."
If a user is unaware that their device has been tampered with and signs in to and uses an app on the device, their account and personal data may be at risk and it can be difficult to check the system integrity of devices. iCard needs to integrate a powerful detection capability to check whether the device running the app is risky.
Solution – integrating SysIntegrity API
Fortunately, by integrating the SysIntegrity API of HUAWEI HMS Core Safety Detect Kit, iCard can quickly check whether the device is secure or rooted during user sign-in. SysIntegrity is free for developers to use and works using the Trusted Execution Environment (TEE), and helps app developers build security capabilities to protect user privacy and app security through tamper-proof and reliable check results.
Risk prevention, starting from App login
Martin Dimitrov said, "With SysIntegrity integrated, our app can detect risks once a user signs in to it on a rooted device, and it will then show a security warning to notify the user of possible risks, such as financial losses and information leaks." Furthermore, it only takes 1 person-day to integrate SysIntegrity.
(iCard app displays a message indicating that the phone is risky.)
Martin Dimitrov added, "After integrating SysIntegrity, the instances of risky sign-in on rooted phones have been reduced by around 10% which is a really good number. And we can also make the development process more convenient and efficient."
Results
The instances of risky sign-in on rooted devices reduced by about 10%.
User accounts and transactions are now well safeguarded.
Find out more on:
Huawei developers official page
Experience the easy-integration process on Codelabs
Submit a trouble ticket online for any problems during integration
Rediit: https://www.reddit.com/r/HuaweiDevelopers/
Github: https://github.com/HMS-Core/hms-safetydetect-demo-android
Stack Overflow: https://stackoverflow.com/questions/tagged/huawei-mobile-services?tab=Newest
Very interesting Security.

[FAQ] Why Is the Event Data Exported from HUAWEI Analytics Inconsistent with That Displayed on the Project overview Page?

HMS Core Analytics Kit provides two ways to view data:
(1) Download event data and import it to your own analysis systems.
(2) View the data on the HUAWEI Analytics > Project overview page.
Symptom​I selected By user ID and device during event data export from HUAWEI Analytics and wanted to import the data to my own analysis system. However, the number of events in the exported data table is smaller than that displayed on the HUAWEI Analytics > Project overview page.
{
"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"
}
Fault Locating​(1) Difference between the exported data and that displayed on the Project overview page
The background query result shows that there were 252,xxx events on a specific day. However, the number of events in the exported data table is only 192,xxx after the data has been deduplicated based on the user ID. There is a 23.7% difference in the data.
(2) Characteristics of the inconsistent data
Through in-depth analysis, it is found that in the inconsistent data, 18.5% of users have triggered only automatically collected events, and 5.2% of users are AAID users without user IDs.
Root Causes​Data export does not support the export of automatically collected events. Therefore, users who have triggered only automatically collected events will not be included in the exported data table.
The data displayed on the Project overview page is collected based on the UID and DID. However, the exported data does not contain DID data. As a result, there is less data.
Solution​If you want to collect statistics by user ID and obtain more comprehensive user data, you are advised to directly configure custom events at the app launch entry point, so that custom events can be triggered as soon as a user accesses your app. Otherwise, if a user exits the app without performing any operations, only automatically collected events can be triggered and such data will not be included in the exported data table.
References​Official website of HMS Core Analytics Kit
Development guide of HMS Core Analytics Kit

Categories

Resources