This is originally from HUAWEI Devloper Forum
Forum link: https://forums.developer.huawei.com/forumPortal/en/home
This article provides tips for integrating HUAWEI Windows Share Kit, with the goal of accelerating the 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"
}
As introduced in the Share Kit | Fully-Open HUAWEI Windows Share Kit Unveiled, Offering a New Paradigm for Phone-PC File Transfers, HUAWEI Windows Share Kit is designed to facilitate quick wireless transfers between Huawei phones and Windows PCs. By integrating Huawei Share capabilities into Windows PC apps, developers can facilitate high-speed file transfers between Huawei phones and Windows PCs.
Next, we'd like to share some tips for integrating HUAWEI Share Kit into Windows PC apps.
l Check whether your device meets the specification requirements. Currently, only devices that run Windows 10, and come in any of the following network adapters, are supported:
- Intel(R) Wi-Fi 6 AX201
- Intel Dual Band Wireless-AC 9560
- Intel Dual Band Wireless-AC 8275
- Intel Dual Band Wireless-AC 8265
- Intel Dual Band Wireless-AC 8260
l To determine whether your device's network adapter meets the requirements, check the network adapter ID. (In later versions, you can also do so by calling the specific API.)
Go to Start > Run, enter CMD, and click OK.
In the command prompt window, enter IPCONFIG /ALL and press Enter.
The 12-digit code displayed to the right of Physical Address is the ID of the network adapter on the computer.
Make sure that the compiler and compilation settings are consistent, as the APIs are provided using static linking, and message callback is implemented by directly exporting classes. Please remain aware of the scope of the exported class object, in order to prevent unnecessary breakdowns or API calling failures from occurring.
Folder-based sharing is currently not supported. An I/O error message will display when attempting to share folders. It is recommended that you display a message to warn the user in advance of this issue, when they select a folder to share.
The discovery module is based on Bluetooth BLE advertising. It discovers a target device (a Huawei phone) for file transmission by using the BLE advertising channel. In order to avoid unnecessary resource consumption, the advertising interval and time should be properly managed.
I did not know we could use Share kit with windows apps. This is a great tutorial.
Related
More articles like this, you can visit HUAWEI Developer Forum and Medium.
{
"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"
}
In this article, we will learn how to implement Huawei Share Kit in the android project.
Huawei Share Kit provides an easy interface to use so that it can share images, videos, and docs, etc. It delivers stable file transfer speeds that can exceed 80 Mbps if the third-party device and environment allow.
Introduction:
1. As a cross-device file transfer solution, Huawei Share uses Bluetooth to discover nearby devices and authenticate connections, then sets up peer-to-peer Wi-Fi channels, so as to allow file transfers between phones, PCs, and other devices.
2. To ensure user experience, Huawei Share uses reliable core technologies in each phase of file transfer.
Devices are detected using in-house bidirectional device discovery technology, without sacrificing the battery or security
Connection authentication using in-house developed password-authenticated key exchange (PAKE) technology
File transfer using high-speed point-to-point transmission technologies, including Huawei-developed channel capability negotiation and actual channel adjustment
Let’s see the working principles:
Integration part:
Huawei Share kit provides two types of implementation in which first implement depend on Huawei (Sender) to Huawei (Receiver) devices.
The second type of implementation which is based on the Android device (Sender) to Huawei device (Receiver).
In this article, we will implement the second type of implementation which is not available on any documentation or code lab.
But the first type of implementation is already provided in Huawei code lab with sample code.
What You Will Need?
Hardware Requirements
A computer (desktop or laptop) that runs Windows 7 or Windows 10
A Huawei phone (with the USB cable), which is used for debugging
A third-party Android device, which is used for debugging
Software Requirements
JDK 1.8 or later
Android API (level 26 or higher)
EMUI 10.0 or later
Let’s create a Sample Demo:
1. Create an Android Studio project:
2. Enter the file name and project location and click Finish:
3. Add Share SDK in the project:
4. We need to add the code repository to the project root directory gradle.
Code:
maven {
url 'http://developer.huawei.com/repo/'
}
5. We need to add the following dependencies in our app gradle.
Code:
dependencies {
implementation files('libs/sharekit-1.0.1.300.aar')
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.android.support:localbroadcastmanager:28.0.0'
implementation 'com.android.support:support-compat:28.0.0'
implementation 'com.google.guava:guava:24.1-android'
}
Note: You need to raise a ticket to get Share Kit SDK “sharekit-1.0.300.aar” file
Click on the below link and raise your ticket.
https://developer.huawei.com/consumer/en/support/feedback/#/
6. We need to add two permission to our android project.
Code:
android.permission.READ_EXTERNAL_STORAGE
android.permission.ACCESS_FINE_LOCATION
7. Click Sync now or Sync Project with Gradle Files to build a project.
We will cover code implementation in the next part of this article.
For your information, I will show you the final output of this sample.
Android device (Sender):
Huawei device (Receiver):
If you have any doubts or queries. Please leave your valuable comment in the comment and ask your question in HUAWEI Developer Forum.
More information like this, you can visit HUAWEI Developer Forum
Introduction
So you have built a wonderful application but how to test it.
Or do you want to test you application on a specific device.
Let us meet your new friendly developer tool HMS Toolkit. This tool provide us the functionality of Cloud Debugging.
HMS Toolkit Installation:
If you have not yet installed HMS Core Toolkit then please go to below link to download the latest version of it before proceeding further into the article.
https://developer.huawei.com/consumer/en/doc/development/Tools-Library/toolkit-download-0000001050148172
Once downloading is done for the plugin you can directly install it via Install Plugin from disk option.
After installation it should show like below.
By the time of writing this article the latest version was 3.0.1.300.
{
"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"
}
Let’s Start with Cloud Debugging
Step by step I will guide you on how you can use this tool to test and debug your application without a real Huawei Device.
Step 1: Go to HMS and click Cloud Debugging as shown below.
Cloud debugging needs a user login in order to provide access to real devices. Hence you will be redirected to a URL where you need to confirm your identity for a successful login.
Step 2: Login and allow the service.
Once the service is allowed you will get a success message and your android studio will get access to real remote devices.
Step 3: If this screen is not opened click on cloud debugging in right sidebar.
Filters are available as highlighted below to get a specific device.
You can also check the availability of device by checking Available Devices
Once the list of device is available choose any one and proceed.
Step 4: Below should be the result after filter selection. Click Run and start the device.
A device should appear which can be accessed by sidebar. Default testing time is 2 Hours but if your testing require more time you can choose the same device once again after it gets released automatically.
Step 5: Let us run one application to see how it is performing on Cloud Debugger.
Let us see what all configurable options are given to us with this cloud debugger.
Screen Resolution:
Different resolution for a device are mentioned.
My recommendation – If your internet connection is good then go for higher resolution.
Screen Size:
You can also control screen size between 75%, 100% and 125%. To do that see the below screenshot.
Apart from this all three navigation buttons are provided to you for better control.
Conclusion
I hope you this article had given some insights in cloud Debugging.
In case you face any issue in the installation process do comment.
PS: You can also use this while presenting your screen, it doesn’t consume resources like how android emulator would do.
References
Get Application Insights and start Improving your application in minutes using HMS Toolkit Cloud Testing
HMS Toolkit - Automatic HMS SDK Integration
HMS Toolkit Convertor - Your New Best Friend for Migration
Its very interesting tool but when am trying to connect through cloud debugging am get below error
Request remote service failed: error_code 30002, 暂无可用设备,请稍后再试
Overview
We've grown accustomed to the hassle of connecting our devices to the Wi-Fi networks in new locations, which can be an annoyance at best, and a major frustration at worst. But perhaps more importantly, this process also comes with the risk of password leakage. Wouldn't it be nice if there was a way to connect our devices to Wi-Fi networks on an automatic basis, rather than having to manually enter the password each time?
HUAWEI Nearby Service offers a Wi-Fi sharing feature, which once integrated, equips your app to connect users on a wide range of smart devices to the Wi-Fi networks that they encounter.
Wi-FiShareDemo
Here, we've used Wi-FiShareDemo as an example, which has integrated the Wi-Fi sharing function in Nearby Service. Now, we'll show you the core code for the app, and how the app can be run.
Preparing Tools
One Huawei phone (The phone for sharing Wi-Fi must be a Huawei phone, and be connected to Wi-Fi.)
One Android device (The device to be connected to Wi-Fi must run Android 5.0 or later and have HMS Core installed, and can be a phone or a TV box.)
Android Studio (3.X or later)
Creating an app
Import the source code to Android Studio.
Register as a Huawei developer.
Create an app in Huawei AppGallery. For details, please refer to HUAWEI Developers-App Development. Note that you will need to download the agconnect-services.json file, generate the signing certificate, and save both to the app directory.
{
"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"
}
Run the app in Android Studio and install it on the test devices.
Procedures
After configuring the code and completing the installation, perform the following steps.
1.Start Wi-FiShareDemo on B, and tap Connect Wi-Fi.
2.Start Wi-FiShareDemo on A, and tap Share Wi-Fi.
3.On A, select the phone that will share Wi-Fi, make sure that the verification codes on both phones are the same, and tap ALLOW.
4.On B, tap ALLOW in the dialog box that is displayed to authorize the Wi-Fi connection.
Core Code
You can view the source code of the app in GitHub. In this app, the WifiShareHelper.java class is encapsulated based on the Nearby Service APIs. Only the APIs requestWiFiConfig and shareWiFiConfig for WifiShareHelper.java are used to connect to and share Wi-Fi.
requestWiFiConfig
// The device request to connect WiFipublic void requestWiFiConfig() { Log.d(TAG, "requestWiFiConfig"); mWifiShareEngine.startWifiShare(mWifiShareCallback, WifiSharePolicy.POLICY_SET) .addOnFailureListener(e -> Log.e(TAG, Objects.requireNonNull(e.getMessage())));}
shareWiFiConfig
// The device to share wifipublic void shareWiFiConfig() { Log.d(TAG, "Start to share WiFi"); mWifiShareEngine.startWifiShare(mWifiShareCallback, WifiSharePolicy.POLICY_SHARE) .addOnFailureListener(e -> Log.e(TAG, Objects.requireNonNull(e.getMessage()))); showListView(); setListViewListenerMode();}
Learn More
For more details, please visit HUAWEI Developers.
For further instructions, please refer to Development Guides.
To join the developer discussion, please visit Reddit.
To download the demo and sample code, please go to GitHub.
To resolve integration issues, please go to Stack Overflow.
HMS Toolkit is an IDE plugin which provides all the tools you need to develop and release HMS Core-integrated apps in Android Studio. You can use it to create, code, convert, debug, test, and release your apps, and it cuts the cost of development and boosts efficiency by more than three times.
{
"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"
}
l Functions
Configuration Wizard enables you to quickly prepare your environment for the integration of HMS Core kits. The configuration process originally comprised 14 steps, during which you had to frequently switch between the IDE and AppGallery Connect. But with this tool, you can automatically configure a full environment, including your team, project module, AppGallery Connect file, and project certificate. It saves a lot of preparation time and improves your efficiency when developing.
l Highlights
Automatic configuration with one click
Streamlines the configuration process.
No need to keep checking documents or switching tools.
Various configuration scenarios
Supports configuring multiple kits at the same time.
Supports all kits for which development preparations are required.
Efficiency boost
Shortens the configuration process from 4 hours to 5 minutes.
Provides you with clear guidance.
l Usage
If you have any questions, please submit a ticket. Huawei technical support will reply to you as soon as possible.
For more information about HMS Toolkit, go to >>
For how to quickly integrate each kit using HMS Toolkit, go to >>
For more operation tutorials, go to >>
For more details, you can go to:
l Our official website
l Our Development Documentation page, to find the documents you need
l Reddit to join our developer discussion
l GitHub to download demos and sample codes
l Stack Overflow to solve any integration problems
Original Source
• How to send message from Android device to watch?
• How to generate the certificates to build the application?
• How to run the application on watch?
Use case 1: How to send message from Android device to watch?
How to send messages and instruction through the smart phone to sports watch.?
Solution:
Use P2P mesaage sending and receiving of wear engine to do the communication. After integrating the wear engine CP was able to send the map related information from smart phone (https://developer.huawei.com/consumer/en/hms/huawei-wearengine)
P2P communication https://developer.huawei.com/consum...ides/smartwatch-send-message-0000001052540469
{
"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"
}
Use Case 2: How to generate the certificates to build the application?
In order to run a build on emulator or watch we need to generate .p12,.cer and .p7b certificates. Without adding these things developer cannot run the application.
Solution:
Document has been released with all details.
Document
developer.harmonyos.com
Use Case 3: How to run the application on watch?
To install .hap file on real watch we need to make use of assistant app to install the file. Even udid should be added during the certificate generation.
Solution:
UDID was not added on the console to register the device
Generated UDID was not supporting for Harmony development
Martin Bieber said:
• How to send message from Android device to watch?
• How to generate the certificates to build the application?
• How to run the application on watch?
Use case 1: How to send message from Android device to watch?
How to send messages and instruction through the smart phone to sports watch.?
Solution:
Use P2P mesaage sending and receiving of wear engine to do the communication. After integrating the wear engine CP was able to send the map related information from smart phone (https://developer.huawei.com/consumer/en/hms/huawei-wearengine)
P2P communication https://developer.huawei.com/consum...ides/smartwatch-send-message-0000001052540469
Use Case 2: How to generate the certificates to build the application?
In order to run a build on emulator or watch we need to generate .p12,.cer and .p7b certificates. Without adding these things developer cannot run the application.
Solution:
Document has been released with all details.
Document
developer.harmonyos.com
Use Case 3: How to run the application on watch?
To install .hap file on real watch we need to make use of assistant app to install the file. Even udid should be added during the certificate generation.
Solution:
UDID was not added on the console to register the device
Generated UDID was not supporting for Harmony development
Click to expand...
Click to collapse
Does harmony OS supports TV?