New Feature in Nearby Service: Wi-Fi Sharing - Huawei Developers

1. Introduction to Wi-Fi Sharing
We've grown accustomed to having to spend time connecting our devices to Wi-Fi networks in new locations. Requesting and entering a Wi-Fi password can often be a hassle, and sometimes it can prove to be a major frustration. But perhaps more importantly, this process also comes with password leakage risks. HUAWEI Nearby Service offers a Wi-Fi sharing feature. When this feature is integrated, your app will be equipped to help users connect a wide range of smart devices to the Wi-Fi networks they encounter.
2. Wi-Fi Sharing Principles and Highlights
2.1 Principles
{
"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 shown in the figure above, users can use Bluetooth to enable their phones to discover devices, such as other phones, smart TVs, TV boxes, or smart speakers. Then they can simply select a device, after which Nearby Service will automatically configure the Wi-Fi settings and connect the device to the Wi-Fi network.
2.2 Hassle-Free Wi-Fi Connections
With the Wi-Fi sharing feature, users can connect their devices to Wi-Fi without needing to request and enter a Wi-Fi password, manually turn on the Wi-Fi switch for the device to be connected, or spend time determining a suitable Wi-Fi network, greatly enhancing the user experience across the board.
2.3 Effective Safeguards for User's Wi-Fi Information
1. Only the currently connected Wi-Fi network on the user's device can be shared. Wi-Fi networks that are saved on the device but not connected cannot be shared, ensuring that they are not affected.
2. Wi-Fi passwords are not disclosed, preventing password leakage.
3. HMS Core encrypts Wi-Fi passwords before transmission, preventing them from being eavesdropped.
4. HMS Core automatically configures the Wi-Fi on the device to be connected. The SSID and Wi-Fi passwords are not provided externally.
5. Only nearby devices (for example, devices within 10 meters) are eligible to share Wi-Fi.
6. A verification mechanism is provided for users to reject applications from untrusted devices.
3. Integration of Wi-Fi Sharing
3.1 Integration Process
1. Enable Wi-Fi sharing.
a. Call WifiSharePolicy to set or share Wi-Fi as required.
b. Register WifiShareCallback to process callback events.
c. Call the startWifiShare() API to enable Wi-Fi sharing.
2. Share Wi-Fi.
Call the shareWifiConfig() API to share Wi-Fi with the remote endpoint.
3. Disable Wi-Fi sharing.
Call the stopWifiShare() API to disable Wi-Fi sharing on the local endpoint.
3.2 Integration Restrictions
1. Devices whose Wi-Fi is to be shared must be Huawei phones that run EMUI 4 or later and have HMS Core installed.
2. Devices to be connected to Wi-Fi must run Android 5.0 or later and have HMS Core installed.
3. The Wi-Fi to be connected should be encrypted in WPA2-PSK mode.
4. Learn More
For more information, please visit HUAWEI Developers-Nearby Service.
For detailed instructions, please visit Development Guide.
To download the demo and sample code, please visit Github.

Related

Huawei G700 keeps asking permission to use mobile data after WiFi disconnects

I recently bought a Huawei G700. It's a fairly new and uncommon device. It runs Android 4.2.1 in combination with Huawei's own Emotion UI
When I have WiFi enabled and for some reason my Wifi disconnects (for example I go out of reach), my phone keeps asking me, each and every time, if it's allowed to use Mobile Data. if I don't answer, my mobile data does not connect thus I can't recieve any mails etc which is highly annoying.
This is the exact error/popup message that I get:
Data connection change
WLAN is unavailable, try to connect to mobile network?
I've googled this exact phrase, but I get 0 results.
How can I prevent my phone from asking if it's allowed to use mobile data?
Freekers1337 said:
When I have WiFi enabled and for some reason my Wifi disconnects (for example I go out of reach), my phone keeps asking me, each and every time, if it's allowed to use Mobile Data. if I don't answer, my mobile data does not connect thus I can't recieve any mails etc which is highly annoying.
Click to expand...
Click to collapse
Did you find out yet how to disable this?
_mfm_ said:
Did you find out yet how to disable this?
Click to expand...
Click to collapse
It seems that this behavior is present in all recent Chinese ROMs from Huawei and there is no way to disable it. However, I found a workaround for it; The message only popsup if you have WiFi and Data Enabled and you lose WiFi connectivity. Then your phone will ask if it's allowed to switch from WiFi to Data. So, if you make sure WiFi is disabled before switching to Data, it will not ask this question. To do so manually, takes a lot of time. Luckily there is an app that can automate this task for you. Here's how:
Install the app 'Llama' from the Market (Free) and create these two events:
{
"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 1 second delay is necessary, else it does not work properly.
What it does: Switch off WiFi as soon WiFi disconnects from your WiFi network and then enables Data. This way, it does not show the popup and 'automatically' switch to Data. Don't forget to manually enable WiFi again if you are in reach again of your WiFi network.
If you want Llama to automatically turn back WiFi on as soon you get home/in reach of your WiFi, you have to let it learn your location. Read the help/documentention on how to do so. It's pretty easy to do
This 'fix' works for me 9 out 10 times. Give it a try, I hope it helps you.
Kind regards.
Freekers1337 said:
It seems that this behavior is present in all recent Chinese ROMs from Huawei and there is no way to disable it. However, I found a workaround for it; The message only popsup if you have WiFi and Data Enabled and you lose WiFi connectivity. Then your phone will ask if it's allowed to switch from WiFi to Data. So, if you make sure WiFi is disabled before switching to Data, it will not ask this question. To do so manually, takes a lot of time. Luckily there is an app that can automate this task for you. Here's how:
Install the app 'Llama' from the Market (Free) and create these two events:
The 1 second delay is necessary, else it does not work properly.
What it does: Switch off WiFi as soon WiFi disconnects from your WiFi network and then enables Data. This way, it does not show the popup and 'automatically' switch to Data. Don't forget to manually enable WiFi again if you are in reach again of your WiFi network.
If you want Llama to automatically turn back WiFi on as soon you get home/in reach of your WiFi, you have to let it learn your location. Read the help/documentention on how to do so. It's pretty easy to do
This 'fix' works for me 9 out 10 times. Give it a try, I hope it helps you.
Kind regards.
Click to expand...
Click to collapse
What happens if you use Gravity box and pop up notification blocker?

[Q] How does android determine if it has internet connectivity

Question is as exactly as it is in the title; how does Android come to the conclusion that it has complete internet connectivity (or connection to google services), and consequently will turn the signal bars blue (on stock android devices).
I am trying to fix a problem at work where if I put my phone on the company wifi, my phone never seems to think it has internet connectivity, even though I do. The consequence is most apps don't attempt to pull new data, and therefor never notify me of new messages. This includes gmail, google voice, and hangouts.
I don't have direct control of the network infrastructure at the moment, so right now it is easier to know what address or IP it tries to get to, and how (ping?), so it can be unblocked by the firewall or web filter.
bump
Does really no one know? Perhaps a point in the right direction?
coreno said:
bump
Does really no one know? Perhaps a point in the right direction?
Click to expand...
Click to collapse
check your settings>wireless & Networks> WIFI>check Network notification this will inform you when there are other open wifi networks present > you need to connect to that network with password or scroll down to add WIFI network (you can add any network when you know its SSID and security used.
if you unchecked network notifications, you will " NOT" know or use of any new networks other than what you have used before.
Check this out!You , YES! you are an " Android ". Not your phone but U.
You Must watch this documentary concerning your privacy Terms & Conditions we had agreed to, by using a PC or Smartphone
How to say Thank you? If you find any post helpful on XDA, please click on the Thanks button
{
"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"
}
If you are using XDA App or Tapatalk, long press on the post and select :good: Thanks Its easier to give "Feedback" in this manner than make an additional post.​
xsenman said:
check your settings>wireless & Networks> WIFI>check Network notification this will inform you when there are other open wifi networks present > you need to connect to that network with password or scroll down to add WIFI network (you can add any network when you know its SSID and security used.
if you unchecked network notifications, you will " NOT" know or use of any new networks other than what you have used before.
Click to expand...
Click to collapse
I'm not having any issues finding or connecting to wifi, the problem is at my buisness when on wifi, android does not detect an internet connection; so it thinks I just have local network access, so most apps do not auto refresh in the background.

Possible to connect to wifi AND cellular data at same time?

Hi all. I have a new Mitsubishi Outlander PHEV s-edition 2017, who got app control through wifi spot from car. However, the wifi range is horrible, so I was wondering if you guys know of any phone that can be connected to both wifi net (without internet) and same time connected to internet through cellular data (3g or 4g)
What I want:
Have a phone in car, connected to the cars wifi net (no internet) and through perhaps an app like airdroid, connect to that phone, and that way connect to the car through internet.
I have tried this with honor 7, but this so called smart phone, either is on wifi with no internet, or cellular data with internet. It will not work on both nets at same time.
Is the any android phone this would work on, or is there any workaround/hack to make this work. Surely, this has to be possible?
-Thanx, Ray
RayBomb said:
Hi all. I have a new Mitsubishi Outlander PHEV s-edition 2017, who got app control through wifi spot from car. However, the wifi range is horrible, so I was wondering if you guys know of any phone that can be connected to both wifi net (without internet) and same time connected to internet through cellular data (3g or 4g)
What I want:
Have a phone in car, connected to the cars wifi net (no internet) and through perhaps an app like airdroid, connect to that phone, and that way connect to the car through internet.
I have tried this with honor 7, but this so called smart phone, either is on wifi with no internet, or cellular data with internet. It will not work on both nets at same time.
Is the any android phone this would work on, or is there any workaround/hack to make this work. Surely, this has to be possible?
-Thanx, Ray
Click to expand...
Click to collapse
If your android running on marshmallow then there is a option in developer setting of cellular data always active. Turn that feature on and connect to mobile data and wifi simultaneously.
Ashwinirg answered the question, but I want to throw in that there are services, like Speedify, which claim some sort of "channel bonding" that merge your WiFi with your data connection to enhance your speed. I have no idea if Speedify or similar services actually work, but if you're interesting in enabling wifi + cellular data together, you might want to look into those services also.
Ashwinrg said:
If your android running on marshmallow then there is a option in developer setting of cellular data always active. Turn that feature on and connect to mobile data and wifi simultaneously.
Click to expand...
Click to collapse
Sweet, Thanx man! This worked. I was able to connect my iPhone to the honor 7 to my car with your workaround. Time to buy me some android phone
Sent from my iPad using Tapatalk
Ashwinrg said:
If your android running on marshmallow then there is a option in developer setting of cellular data always active. Turn that feature on and connect to mobile data and wifi simultaneously.
Click to expand...
Click to collapse
Is this option also available in Android version. 7.xx?
Sent from my iPad using Tapatalk
RayBomb said:
Is this option also available in Android version. 7.xx?
Click to expand...
Click to collapse
Don't know if it is available in android nougat but it may be it available on marshmallow then it also available in Nougat..
Update:
So I bought myself a Lenovo p2, cause of its bigger battery, but it seems like it's not able to go between cellular data and wifi seamlessly like honor 7 did. It got the same options in developer mode, but it's not working.
{
"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"
}
Certain apps work if set right. It's kind of like downloading a torrent. Multiple connections work together to transfer the same file resulting in much faster speeds.

Vysor app issues?

just dropped $40 on the vysor pro app (hard to tell what it can really do with the free version) but can't seem to get it to accept wireless mode when trying to mirror my shield to my pc, when i try i get the below message... i've also installed vysor on a tablet and it has no problem with wireless mode... i've tried every recommendation i could find in order to resolve this prob but no luck, which includes:
- disabling ipv6
- trying both 2.4 and 5.0 wireless connections
- updating universal adb drivers
- changed usb configurations (mtp, ptp, etc.)
also worth mentioning, my shield wi-fi works fine with everything else, and shows in my windows explorer.
{
"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"
}
aeneas1 said:
but can't seem to get it to accept wireless mode
Click to expand...
Click to collapse
I just found this thread long after I got Vysor (and scrcpy) to work (almost) flawlessly on Android 11 (with USB setting up the initial adb connection and then switching to Wi-Fi thereafter)....
In early May I updated from Android 11 to Android 12 and I found out that Android 12 has a fantastic new Developer option "Wireless debugging" feature where you can set up the adb connection to the PC completely over Wi-Fi (no need for the initial USB connection!).
I just wanted people to know new information related to using Vysor completely over Wi-Fi (no USB connection is ever needed again!).
This always on Wi-Fi Vysor capability is new in Android 12 because Android 12 has a new Developer option for "Wireless debugging".
However, Android 12 also has a new Developer option for "Enhanced MAC Randomization" which randomizes the MAC address on every Wi-Fi connection, so with that added desired Wi-Fi simplicity in Android 12 comes also the added desired privacy of MAC randomization on every connection (the difference being Android 11 only randomized the MAC per SSID, as far as I understand it).
All this new Android 12 functionality has implications for your Vysor (and scrcpy) setup, based on my tests over the past couple of months.
Of course, if your router is using the MAC address to hand out the IP address you might need address reservation since the router can no longer expect a consistent MAC address if you set that new Android 12 Developer option but you can set the Android phone to request a "Static" IP address (if you want the adb connect commands to be consistent in the IP address in day to day usage).
I have found that rebooting the PC causes me to need to reconnect via an adb command on the PC before Vysor will work, and, for unknown reasons yet, often the Android 12 "Wireless debugging" switch gets turned off (mysteriously) - which affects the Vysor (and scrcpy) connections from one day to another.
It's no big deal once you figure out the commands and switches though, where the screenshots below show the settings I currently have on my unrooted Android 12 Samsung Galaxy A32-5G phone from T-Mobile (many of which are for privacy and functionality reasons).

Question Mobile/Cellular Data turns off when on USB Debbuging Mode and connected to scrcpy

Hello Everybody,
today I tried to use scrcpy to remote control my Pixel 6 (Android 12, Build Number SP2A.220405.004) via USB.
USB Debugging has been activated.
However, as soon as I establish a connection from scrcpy to my phone, the cellular data symbol switches to this
{
"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 soon as I disconnect the usb cable it will have a data connection again.
Does anybody have an idea where this could come from?
Did I miss some settings?
Thanks in advance
cbytime said:
Hello Everybody,
today I tried to use scrcpy to remote control my Pixel 6 (Android 12, Build Number SP2A.220405.004) via USB.
USB Debugging has been activated.
However, as soon as I establish a connection from scrcpy to my phone, the cellular data symbol switches to this View attachment 5611891
As soon as I disconnect the usb cable it will have a data connection again.
Does anybody have an idea where this could come from?
Did I miss some settings?
Thanks in advance
Click to expand...
Click to collapse
Im not familiar with the phone, but there are some settings that could be causing the issue. Here are a few:
In 'developer options', the switch 'Verify Apps over USB' could prevent the program from running...switch that to 'off'. Check Google Play Protect, turn off to test. Those may not be allowing the 'scrcpy' to function.
Also, the phone may think its in a wifi network, so it kills the data connection. In 'dev options' there should be a switch called 'Mobile data always active', when wifi is active, turn that on.
In Settings, under 'Hotspot & Tethering', there is a switch 'USB Tethering' ->share phone's internet connection via USB ->set to on.
In 'Wi-Fi Preferences', the switch 'Auto switch to mobile data', set to on.
Test also the 'Tethering hardware acceleration' option in 'dev options', it may be interfering with the program.
It could just be a tethering issue.
On a final note, if you have root or command line access, you can set the local routing tables to function with wifi & data like this:
1. "ip rule" //shows routing tables
2. "ip rule add from all lookup main pref 1" //adds table as 2nd in line.
The latter rule allows data & wifi to function in same routing network. May or may not be necessary to resolve your issue.
Wow - I didn't expect a reply that fast
I'll check the settings later when I'm back at a PC and post my results. Thanks a lot @Xpltr
Simply disabling wifi solves the problem.
Thank you for all the tips, maybe I'll find some time in the future to check the other points and find the root cause.

Categories

Resources