Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 29428

How to use link to connect to WiFi in react native

$
0
0

How do i use a link in react native to connect to wifi? So i have this piece of code:

import {Linking, Component, Button} from 'react-native';

export default class MyLinkScreen extends Component{

     private connectWifi(){
         Linking.openURL('WIFI:T:WPA;S:SampleSSID;P:SamplePassword;H:false');
     }

     public render(){
         return (
             <Button onPress={()=>this.connectWifi()}>Connect</Button>
         )
     }

}

but i ends up having this error in android: error [Error: Could not open URL 'WIFI:T:WPA;S:SampleSSID;P:SamplePassword;H:false': No Activity found to handle Intent { act=android.intent.action.VIEW dat=WIFI:T:WPA;S:SampleSSID;P:SamplePassword;H:false flg=0x10000000 }]

so any idea on how to make my link to prompt connect to wifi as if we scan the wifi qr code? Thank you.


Viewing all articles
Browse latest Browse all 29428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>