Open Patrick-Erichsen opened 4 years ago
From the android oreo version and above hotspot API has been protected and became systemApi, This library does not yet support these versions I will do update ASAP but I wish to get some free time to do this. PRs welcome as well
Hey @assemmohamedali , thanks for the quick reply!
From the research I've done, it doesn't seem like there is a public API in Oreo and above to programmatically create hotspots with internet access. The only option is startLocalOnlyHotspot, which does not provide internet access.
This is one of the drawbacks of new android versions currently. The only way to enable/disable with internet access capability is to ask a user to do it manually although the second hardest approach is to use a virtual VPN with startLocalOnlyHotspot,
I'm thinking of making a PR that would allow the library to work using startLocalOnlyHotspot
. For the use case my team is investigating, we would not need internet access so this would be suitable.
Would you accept a PR that implements that?
Absolutely yeah. it would be suitable for transferring files and do some async actions on two/more devices.
@assemmohamedali I'm struggling a bit to get this working.
To begin with, I'm trying to just get the library as-is to function on an up-to-date version of RN. On my fork, I've created a fresh project using react-native init TestApp
and am simply trying to get the library working with that project.
However, I am getting the same issue as described in #23 when running react-native run-android
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
> Could not resolve project :react-native-wifi-hotspot.
Required by:
project :app
> Unable to find a matching configuration of project :react-native-wifi-hotspot:
- None of the consumable configurations have attributes.
My settings.gradle
looks like this:
rootProject.name = 'TestApp'
include ':react-native-wifi-hotspot'
project(':react-native-wifi-hotspot').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-wifi-hotspot/android')
include ':app'
include ':hotspotmanager'
project(':hotspotmanager').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-wifi-hotspot/android/hotspotmanager')
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
and my app.build.gradle
includes this line:
dependencies {
implementation project(':react-native-wifi')
...
}
My hunch is that it is a gradle issue that I'm not familiar with.
In my gradle-wrapper.properties
I have this line:
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
and in my top-level build.gradle
I have this:
dependencies {
classpath("com.android.tools.build:gradle:3.4.2")
....
}
react-native-wifi
and my
app.build.gradle
includes this line:dependencies { implementation project(':react-native-wifi') ... }
I think the error here where it should be react-native-wifi-hotspot not react-native-wifi
@assemmohamedali I have a draft PR open here for this work. Hoping to have it cleaned up and ready for your review over the weekend!
Hey @Patrick-Erichsen Have you got success to enable the hotspot and other features with the changes you made (in latest react native version) ??
@rachitgupta98 that is correct - the new TestApp/
project I created in the repo is on RN 0.61.5
and it is able to interact with the library and create a local-only hotspot. Note that this hotspot does not have internet connectivity, however.
As I mentioned - the PR isn't quite ready for review yet, but the draft is open here if you are interested.
Hey @Patrick-Erichsen , you can update the repo you forked with the changes ,it will be easy to use
@assemmohamedali #25 is ready for review! 👍
Hey @Patrick-Erichsen I tried to use your pe-local-hotspot-only branch as a dependency , getting this error Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'. Could not resolve project :react-native-wifi-hotspot. Required by: project :app Unable to find a matching configuration of project :react-native-wifi-hotspot:
- None of the consumable configurations have attributes.
react-native: 0.61.5 react-native-wifi-hotspot": 1.0.0
Problem
I am unable to enable the hotspot, and therefore cannot create a hotspot.
After running through setup, I am able to reach the testing screen with all of the buttons to enable, disable, etc.
When pressing
ENABLE
, I get a toast notification that readsHotspot Enabled
. However, I'm receiving the following error in Logcat:Then, when I try to create a hotspot, I get a toast error that "Hotspot creation has failed". No error logs show up in Logcat.