Start inbuilt windows MobileHotspot when not connected to a WiFi network - c#

I am trying to spin up mobile hotspot on a windows 10 laptop using a c# program.The requirement is similar to this, but I wont be able to use the NetworkOperatorTetheringManager class since it needs the device to be connected to a wifi network. The ConnectionProfile returned in the below program will be null if not connected to a network.
ConnectionProfile connectionProfile = Windows.Networking.Connectivity.NetworkInformation.GetInternetConnectionProfile();
NetworkOperatorTetheringManager tetheringManager = NetworkOperatorTetheringManager.CreateFromConnectionProfile(connectionProfile);
I know it is possible since there is an app on windows store, called Hotspot Lite which does this. It is possible to start a mobile hotspot using this app without having to be connected to a wifi network.
I am looking for a solution using the windows apis, more specifically using the Windows WiFiDirect api. Appreciate any answer pointing in the right direction.

Related

Bypassing connect bluetooth device permission in c# with windows 10

Context: I'm working on a Windows 10 app that will allow users to quickly connect to a Bluetooth device. Because the native API is difficult to work with, I'm using the 'In The Hand' library. Anyway, back to the point: whenever I make a connect request. Before allowing me to connect, I receive this Pair a device notification.
I'm wondering if I can set Windows to automatically accept this permission for connecting the device. Is there a method in the Windows API that I can use to accomplish this?
Here is the link to the code: https://github.com/hasham7861/bluetooth-le-experiment/blob/master/Program.cs
In the picture I make a connect request to a bluetooth headset and then I get the notification on the bottom right, and only if I click allow to pair device then it pairs the device.
I hope this link helps you.
I apologize in advance if I misunderstood the question or if the data were meaningless
Windows 10 Connect to Bluetooth Classic Device without Pairing
https://github.com/microsoft/Windows-universal-samples/blob/main/Samples/DeviceEnumerationAndPairing/cs/Scenario9_CustomPairDevice.xaml.cs

Discover Nearby Smartphone Devices on Android

Problem Statement
I am trying to make an application for Android that can detect nearby smartphone devices. I need to discover smartphone devices regardless of their connection to a WLAN or their operating system. The only requirement is that their bluetooth or wifi setting is enabled. I am trying to capture the MAC Address and maybe RSSI of these devices. An example of an application I am trying to emulate is Meshlium.
Methods Already Considered
Android Classic Bluetooth:
I have followed the guide to discover devices that aren't currently paired with my device.
The smartphones I am trying to discover need to be in "discovery" mode in order to be found. For most modern phones that means they need to be on their bluetooth settings page.
Android P2P (Wifi Direct):
I have followed the guide again and can't discover smartphones nearby.
Similar to bluetooth, both devices (mine and the device I am trying to find) need to be both trying to discover wifi direct devices.
Also it seems iOS doesn't support wifi direct anyways.
Google Nearby:
Nearby Connections works only with devices running an application that is using the nearby connections api. So only devices with the app currently running the advertising or discovery feature will be available for detection.
Wifi Network Service Discovery:
This lets me see devices that are currently advertising services on a network and not the actual devices themselves.
Device Specifications
The device I am using is running android version 6.0.1 and Model number rk3368-box. The device also has root permissions.
Question
Is there a way on my android device to discover the nearby smartphones with the only requirement being their wifi or bluetooth is enabled? Perhaps packet sniffing the probe requests of the devices? I have researched packet sniffing but can't find any solid resources for Android. Also I would love to be able to do so in c# and Xamarin.Android if possible.
Update
Is a custom ROM an option? I am not looking to make an application for the play store, but one for custom hardware. Perhaps when I enable the wifi hotspot on the device it logs the probe requests from the devices nearby and saves as a file to export later?
There is no way to do this. And there shouldn't be- unless I'm working with you (in which case multiple of the above will work) its a massive invasion of my privacy for you to be able to detect my device.
If you are able to find mac address for WLAN adaptor of a device than try to search for bluetooth devices having mac address same as WLAN adaptor but last digit changed by 1.
This way you can find a Bluetooth device even if it's visibility is hidden

Connect android phone to UWP application offline

I am building a C# UWP Windows 8.1 application. I will like to know if there is a way I can connect my phone to my UWP Desktop app offline. I intended to transfer certain data and eliminate the time it takes for the devices to communicate with the server (- especially in cases of bad/no network here in Nigeria).
You can connect the two devices either using Bluetooth or Wi-fi direct. Bluetooth will probably be easier to setup. The process will be different for both platforms:
Bluetooth - UWP, Android
Wi-Fi Direct - UWP, Android
Bluetooth has broader support, but Wi-Fi direct may prove faster if you want "near real-time" performance.

Data forwarding server

I have the app for Android and another app for PC, both were written by me. Android app connects to the PC app, and the PC app sends data (in realtime) to the smartphone.
The problem is: if the PC is connected to the mobile wireless network, I can't get its address, so I can't connect my Android app to the PC.
So, is there some simple application (for Windows), that I can use as a server for data forwarding. PC and mobile App will be connected to this server (launched on the station with the static address), and the server will just forward data from one app to another?
Or maybe there are good tutorials for creating such kind of server on C#/Java?
I would use a third pc (a server) that acts as a bridge for Android and PC. I wrote a web service in .NET for a virtual server on the internet. Both Android and PC know the ip address (or the domain name) of the server.
The PC talk to server using .NET native web service call, the Android uses ksoap.
For more infomration about ksoap for android look here:
http://code.google.com/p/ksoap2-android/
EDIT:
I suppose you can have the web server in the pc but you need to configure your modem to forward specific ports to the pc. But if you have no static ip address you need to reconfigure the ip address on Android device everytime your modem is rebooted (or switched off/on). You can also try to use dynamic dns services...
Check this out:
http://whiletrue.blog.com/2013/07/11/smartphone-as-pc-controller/
I've made this with Muzzley. Basically, you already have most of the work done if you integrate with it.
(disclaimer: i work for this project)
On the PC side, you can use the lib to include in you pc app in several languages:
(java) http://www.muzzley.com/documentation/libraries/java.html
(.NET) http://www.muzzley.com/documentation/libraries/dotnet.html
(nodejs) http://www.muzzley.com/documentation/libraries/nodejs.html
On the smartphone side, you can use any of the existent widgets (virtual interfaces):
http://www.muzzley.com/documentation/widgets.html
or eventually make your own:
http://www.muzzley.com/documentation/widgets/webview.html
Example:
You can pull from github several examples here:
https://github.com/muzzley/muzzley-demos/
(check the the webview example)
I hope it helps.

Can I use the Bluetooth serial port in Windows Phone 7.1 and up?

I want to develop an app for the Windows Phone app store that communicates with my car's OBD2 port via Bluetooth.
Long story short, the app will use the bluetooth serial port to send a hex value and retrieve the corresponding value in the ECU's register. There's an android app called Torque which does this.
I can't figure out how to use the serial port though. The only bluetooth functionality mentioned is high-level stuff like pushing objects, pairing, etc. But nothing about setting baud rates or writing to a specific COM port.
Is this possible on WP7/*? Or alternatively, how can I make this possible and get my app approved for distribution?
UPDATE: I haven't been able to get my hands on a WP8 device yet, so I can't verify whether or not this is possible using SSP.
As a bonus note in case you came here looking for alternatives: you can also NOT connect to ad-hoc wifi connections, so the wife-based OBD2 adapters are no good either. There is an ugly way of connecting to the latter which involves having a laptop in your car which is simultaneously connected in ad-hoc mode the the device and is also acting as a wifi hotspot. It is utterly impractical.
Using the Bluetooth Serial Port (SSP) is not possible with public APIs of Windows Phone 7.x. As you've kind of guessed already, the app will likely not be approved for the marketplace if private APIs are P/invoked or otherwise used.
Consider upgrading to Windows Phone 8 as the Bluetooth SSP is partially available there, see Nokias Developer site for example.

Categories