blackdeve / react-native-wifi Goto Github PK
View Code? Open in Web Editor NEWA react-native implementation for viewing and connecting to Wifi networks on Android and iOS devices.
A react-native implementation for viewing and connecting to Wifi networks on Android and iOS devices.
I can get it work perfect with ios 12.4 but not working with ios 13!!!
I use the sample call as follows
WifiManager.getCurrentWifiSSID()
.then((ssid) => {
console.log("Your current connected wifi SSID is " + ssid)
}, () => {
console.log('Cannot get current SSID!')
})
And i get the result on android. I checked that the persmission are all there even though I have asked for them in the app
Your current connected wifi SSID is
I'm a newbie with react native and I am trying to use react-native-wifi in my app but nothing is working for me.
I am probably missing something stupid, but like I said I am learning react-native.
So, I npm installed react-native-wifi to my project and linked it
imported WifiManager into my component
I linked a function to a button to call WifiManager.getCurrentWifiSSID() as a test.
That is where i'm blocked... when I tap my button I'm getting an error message : "undefined is not a an object (evaluating '_reactNativeWifi2.default.getCurrentWifiSSID')
What I'm I missing?
Here are my dependencies from package.json
"dependencies": { "expo": "^30.0.1", "native-base": "^2.8.1", "react": "16.3.1", "react-native": "https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz", "react-native-wifi": "^1.0.1", "react-navigation": "^2.18.0" }
So I'm just running the simple case of WifiManager.getCurrentWifiSSID, I've added the import, ran the link command, turned on the WiFi and Hotspot capabilities in Xcode. Build->run, but I get the error "Unhandled JS Exception: null is not an object (evaluating '_reactNativeWifi.default.getCurrentWifiSSID", basically, WifiManager is null, same on console.log. Do I need to 'inject' WifiManager?? Am i missing something obvious? Any help much appreciated!
Is this possible to implement ?
I don't understand why I have to enable location manually or programatically in order to use the wifi functionality.
"react-native": "^0.51.0",
Gradlew 3
targetSdkVersion 27
compileSdkVersion 28
In iOS A warning appears on startup:
"Module WifiManager requires main queue setup since it overrides constantsToExport
but doesn't implement requiresMainQueueSetup
. In a future release React Native will default to initializing all native modules on a background thread unless explicitly option-out of."
Good morning, in native Swift with iOS 11, we can programatically connect in the Network and DONT SAVE the configuration, every single time when the user go to connect in the network, the user will go and open the app every time. Follow the code.
var config = new NEHotspotConfiguration(Ssid, Pw, false);
config.JoinOnce = true;
It's possible to do the same using this plugin? There is a property to turn this behaviour?
At line 283 theres a peace of code, I'm getting this error when I trying to connect to WIFI- WPA/WPA2 PSK:
283 - boolean enableNetwork = wifi.enableNetwork(updateNetwork, true);
284 - if ( !enableNetwork ) {
285 - return false;
286 - };
ENVIROMENT:
RN: 0.54.0
react-native-wifi: 1.0.1
node: 8.9.1
npm: 5.6.0
Digging on Android developers documentation I found this...
I installed with npm and linked with react-native link but the imported asset I get is always null. Is there something wrong with my setup or something I'm not doing correctly?
This is the exact error
TypeError: null is not an object (evaluating '_reactNativeWifi.default.connectToProtectedSSID')
For clarity, I am using Expo and this is my process:
At that point it fails on the connectToProtectedSSID() method with the error stated above.
this is the default package name and should be changed (For example this could be changed to com.blackdeve
)
since it's the default this can cause issues when having another RN module that leaved the same default package name.
also, package name should be meaningful IMHO
I am trying to use the connectToProtectedSSID function and I always get the connection failed alert on my android phone.
I am able to get the wifi list, the current SSID, etc...
Could I be missing some configuration somewhere?
Is there a specific way to send the SSID and Password to the function?
I am using a Oneplus 6 phone and on Android 9
If you need more info, let me know.
Thanks
I can successfully run WifiManager.getCurrentWifiSSID()
however when I run WifiManager.connectToProtectedSSID(ssid, pwd, false)
, the ssid is connected to but I get a "red screen" error page:
Runtime is not ready for debugging. Make sure Packager server is running.
RCTFatal
-[RCTCxxBridge handleError:]
__21-[RCTCxxBridge start]_block_invoke
invocation function for block in facebook::react::(anonymous namespace)::RCTObjc
__58-[RCTWebSocketExecutor _executeJSCall:arguments:callback:]_block_invoke
__44-[RCTWebSocketExecutor sendMessage:onReply:]_block_invoke
...
There is no error message in the logs and this is 100% reproducible ie happens every time on iPhone 6.
When I try to import it gives and error package not found or try npm install @types/react-native-wifi but package not found on this command
it would be nice to include an "enable wifi" function, or at least an "is wifi enabled" function...
However, when executing connectToProtectedSSID with wifi disabled, I get the following exception:
"Attempt to invoke interface method 'java.util.Iterator java.util.List.iterator()' on a null object reference"
connectTo RNWifiModule.java:261
connectToProtectedSSID RNWifiModule.java:186
Is it possible to disable the join confirmation popup on iOS ?
This library appears to use NetworkExtension
within iOS. This is a restricted entitlement that is only
issued by Apple - https://developer.apple.com/documentation/networkextension/nehotspothelper
Code in iOS - https://github.com/blackdeve/react-native-wifi/blob/master/ios/RNWifi.m#L2
Be good to have this documented in the Readme (ideally at the top) before people get burnt by the annoyance with Apple and their heavily restricted iOS platform!!!
This is on overall very nice package, especially with the loadWifiList method :D
Could you please create the method loadWifiList for iOS for consistency?
Use react-native-wifi-reborn instead. It has a similar approach and maintained regularly
there are cases when a disconnect is required, for example the AP you've connected to does not have outward access etc.
Please use https://www.npmjs.com/package/react-native-wifi-reborn
The administrator of this repository has not done so about two years ago, issues and PR are welcome in the new repo.
Hi there,
I recently tried to submit my app to the appstore with this package and it was rejected for using a non-public URL scheme. In particular they were unhappy about the fact that App-Prefs
was being used.
I am not too clued up with native code, but I've read that using UIApplicationOpenSettingsURLString
would be a viable alternative. I would just like to know how to go about implementing this?
Is that possible to implement?
you cannot do "pod install" on macOs because the attribute "homepage" is empty.
Fixed that by inserting "https://github.com/blackdeve/react-native-wifi#readme" into it.
Hello, i'm on MIUI 9.6.2(Android 7.1.2) and, as the title says, i can't get the error callback to execute. Even when i put in the wrong password for the network, i get the success message.
this is the function i'm executing:
async connectToWifi(ssid, password) {
console.log('SSID', ssid)
console.log('PASSWORD', password)
this.setState({status: 4})
WifiManager.connectToProtectedSSID(ssid, password, false)
.then(() => {
console.log('Connected successfully!')
}, () => {
console.log('Connection failed!')
})
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.