Development Guide for Integrating the HUAWEI OneHop Kit 2 - Huawei Developers

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.

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

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

HMS ML Kit - Bank Card Recognition

Bank Card Recognition with ML Kit
The ability to scan and recognize a bank card is essential for financial and shopping apps. ML Kit aims to make the process as simple as possible for developers. Using ML Kit, your app can feature a simple and secure bank card recognition feature. You'll be able to use the camera on a phone to scan and capture the details off of a bank card.
Users of your app will be able to point their camera at their card, and their information will be read quickly. Once the information is gathered, the app will return to a screen where their card number and info have been accurately recorded. This is where the user has an opportunity to review their information and make sure everything is correct.
{
"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"
}
Using the ML Kit demo APK, you can see this technology in action. Use the BCR feature to scan a credit or debit card and see the information show up on your phone. You can even see the security features in action, like how screenshots and screen recording are disabled to prevent saving sensitive information.
How Developers are Implementing Bank Card Recognition Recognition
Developers that are offering apps that host financial services will use ML Kit to make this a secure and easy process. This can also be used as identity verification if this is what your app requires. For example, in the past, when binding a bank card for online payment, users have to manually input their card numbers. It is easy to make mistakes. At present, with the bank card recognition service, inputting bank card numbers is automatic, thereby quick and accurate, greatly improving user experience.
The bank card recognition service can be implemented into an app using this HMS plug-in. Your app can directly call the bank card recognition plug-in to obtain the recognition result through the callback function without processing camera streams.
Developer Resources
Huawei provides plenty of documentation and guides to help you get started with ML Kit's bank card recognition. You can get started with this guide here.
For all of the functions of ML Kit, refer to their service portal here.
For an overview of their APIs, browse the comprehensive resource library here.
You can also look at different ways that ML Kit can be implemented, by seeing a collection of sample codes here.

Ubiquitous Tap-to-Connect Functionality, with HUAWEI OneHop Kit

The increased accessibility of smart devices has led to a dramatic increase in the number of connected devices per person. However, the presence of different operating systems has led to challenges in ensuring the broad compatibility of features across devices. Developers have to devote inordinate amounts of time and money on creating and maintaining different versions for each operating system. To address this, Huawei has proposed a revolutionary solution, in which distributed technology facilitates broad-based compatibility within an all-encompassing "1+8+N" framework, with the goal of providing users with seamless collaborative features.
The HUAWEI OneHop Kit forms a key pillar in this ecosystem, utilizing NFC to facilitate easier cross-app and cross-device data transfer, helping make cross-device functionality the new norm. The OneHop Kit has been opened to device manufacturers, and will soon be supported on a wide range of smart device products. Following the release of Huawei OneHop Kit on the HUAWEI Developer website in 2019, many app makers and device manufacturers expressed enthusiasm at the opportunity to integrate the kit.
Sparkling New Mobile Office Experience, with Futuristic Collaborations Between Huawei Phones and Laptops. The OneHop Kit revolutionizes the transfer of video and image files, freeing users having to rely on third-party apps and devices. Simply select the file you wish to transfer, tap your phone against the NFC tag on the computer, and the file will be transferred to your laptop in the blink of an eye.
{
"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"
}
Smooth Large Screen Projection with Huawei Phones and Laptops. With these two devices, you can project content at will, regardless of the presence of a Wi-Fi network, and with no need to go through a pairing process. Simply tap the phone against the NFC tag on the remote control, and the phone screen will be projected to the smart TV in mere seconds. Projected imagery is remarkably fluid, vivid, and responsive.
Video Continuity with Huawei Phones and Laptops. After an app has integrated OneHop Kit into their apps, it will be capable of transferring and syncing video from one device to another, with astounding ease. Furthermore, users do not have to configure the devices, nor sync the data manually.
Huawei aims to build a fully connected world, with its all-encompassing "1+8+N" framework as a springboard for versatile, and fluid cross-device interactions. Stay tuned for more information about Huawei's cutting-edge connected solutions.
Scan the QR code to visit the HUAWEI Developers website to obtain the development guide and its corresponding SDK.
For details about Huawei developers and HMS, visit the website.
https://forums.developer.huawei.com/forumPortal/en/home?fid=0101246461018590361

Expert: How to Integrate Huawei Ads with GameAnalytics in Unity (Part-2)

Introduction
In this article, we will learn GameAnalytics integration in Unity Game.In previous article, we learnt about some of the features provided by the GameAnalytics.In this part-2 we will implement the Huawei Ads kit, will know practivcally how GameAnalytics helps Huawei Ads events like Ad opened, Ad shown, Ad clicked and Ad failed to show, which can be easily recorded by GameAnalytics and also we will look into SourceEvents and Remote configuration, and other useful features of GameAalytics which makes easy to get custom reports on the various filters you desired.
Development Overview
You need to install Unity software and I assume that you have prior knowledge about the Unity and C#
Hardware Requirements
A computer (desktop or laptop) running Windows 10.
Android phone with API Level 21 or latest and USB cable, which is used for debugging.
Software Requirements
Java JDK 1.7 or more installation package.
Unity software version: 2020.1.15f1.4895 or latest installed.
Integration Preparations
Create Unity project.
{
"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"
}
2. Download GameAnalytics plugin.
3. Download HMS plugin.
4. Create project in AG-Console
5. How to integrate Huawei Ads in Unity
6. Choose Assets > Import package > Custom package select GameAnalytics package file and
click OK.
How do I trigger Ads Events?
Ads Events supports only IOS and Android. The GameAnalytics ad event needs to invoke when certain events happen for implemented ad sdk.
An ad sdk has callback methods activating code when certain things like ad show and ad click activated. GameAnalytics makes easy to capture these call-back events to be recorded one has to call GameAnalytics sdk when these delegates called.
The examples below describes how to implement this for the ad-types.
Rewarded video
Interstitial
Bannner
[ICODE]
GameAnalytics.NewAdEvent([URL='https://gaadaction.show/']GAAdAction.Show[/URL], GAAdType.Interstitial,"onAdShow", ad.getAdId());
GameAnalytics.NewAdEvent(GAAdAction.Clicked, GAAdType.Interstitial,"unityad", ad.getAdId());
GameAnalytics.NewAdEvent(GAAdAction.FailedShow, GAAdType.Interstitial, "unity ads failed to load ", ad.getAdId());
[/ICODE]
How do I trigger Impression Events?
Impression events are used to get impression data from different ad networks. Currently the following ad networks are supported:
MoPub
Fyber
IronSource
MoPub
To record impression data from MoPub, add the following code inside the Start function and the SDK will send automatically the impression events for you.
void Start ()
{
GameAnalytics.SubscribeMoPubImpressions();
}
Fyber
To record impression data from Fyber, add the following code inside the Start function and the SDK will send automatically the impression events for you.
void Start ()
{
GameAnalytics.SubscribeFyberImpressions();
}
IronSource
To record impression data from IronSource, add the following code inside the Start function and the SDK will send automatically the impression events for you.
void Start ()
{
GameAnalytics.SubscribeIronSourceImpressions();
}
How do I fetch Remote Configuration value?
GameAnalytics provides remote configuration which allows user to configure key pair values from the remote place and also it allows user to Schedule that is set start date ad end date of the configuration.
String remoteValue = GameAnalytics.GetRemoteConfigsValueAsString("Test");
How can I download reports?
GameAnalytics allows you to various filter option and which makes user to predict and take decision based on the analysis report, you can download various kind of reports as show in the below image.
Result
Tricks and Tips
Make sure you have downloaded latest plugin.
Make sure that GameAnalytics Object is created.
Make sure that required permissions are added in Manifest.
Conclusion
In this article, we have learnt how to integrate Huawei Ads Kit with GameAnalytics in Unity. Which proves you with the ability to create own custom events depending on what you would prefer to capture, remote configuration, Funnel and provides various filter option on report.
Thank you so much for reading, I hope this article helps you to understand the GameAnalytics features in Unity.
Reference
GameAnalytics
GameAnalytics Unity
GameAnalytics Plugin
Check out in forum
is it different from HSM analytics kit?

Categories

Resources