hypery2k / cordova-hotspot-plugin

A Cordova plugin for managing HotSpot networks on Android
MIT License
37 stars 49 forks source link

hotspot creation failed #63

Closed pierretuaillon closed 5 years ago

pierretuaillon commented 7 years ago

Hi hypery2k,

We try to launch your example but "hotspot creation failed ", we have add permission like you in the file androidManifest and we try to change $scope.config.mode but it's always the same message.

Finally on android version 5.1 it's ok but not on 6.0

androidmanifest

Thank you

hypery2k commented 7 years ago

can you try with 1.2.9?

arjun841997 commented 7 years ago

still not working on android 6.0 checked with "cordova run android"

 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
startHotspot(){
  //  console.log('sdfaasdf');
     let loading = this.loadingCtrl.create({
             content: 'Please1 wait...'
       });
      loading.present();
     this.hotspot.createHotspot('smashcuff','WPA_PSK','123456789').then(() => {

            loading.dismiss();

    });
  }
1qaz2wsx3edc4rfv5tgb6yhn commented 7 years ago

I'm not able to create one as well...

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.testhotspot" android:versionCode="1" android:versionName="1.0">

<uses-sdk
        android:minSdkVersion="9"
        android:targetSdkVersion="21"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>

<application
        android:allowBackup="true">
    <activity android:name="test">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>

            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
</application>

rlaurente commented 6 years ago

any updates on this ? I can't create hotspot too even I have this in permissions

< uses-permission android:name="android.permission.WRITE_SETTINGS" />

hypery2k commented 6 years ago

the plugin is discontinued, so I will not maintain this repo anymore

yurik94 commented 6 years ago

not working on Android 7. This shouldn't be listed on Ionic Native even if it is marked as Beta since months

yurik94 commented 6 years ago
04-03 17:47:03.403 25799-25889/io.ionic.starter E/WifiHotSpots: Unknown error during hotspot creation.
    java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Method.invoke(Native Method)
        at com.mady.wifi.api.WifiHotSpots.startHotSpot(WifiHotSpots.java:430)
        at de.martinreinhardt.cordova.plugins.hotspot.HotSpotPlugin.createHotspot(HotSpotPlugin.java:783)
        at de.martinreinhardt.cordova.plugins.hotspot.HotSpotPlugin$7.run(HotSpotPlugin.java:249)
        at de.martinreinhardt.cordova.plugins.hotspot.HotSpotPlugin$31.run(HotSpotPlugin.java:1003)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
        at java.lang.Thread.run(Thread.java:761)
     Caused by: java.lang.SecurityException: io.ionic.starter was not granted  this permission: android.permission.WRITE_SETTINGS.
        at android.os.Parcel.readException(Parcel.java:1684)
        at android.os.Parcel.readException(Parcel.java:1637)
        at android.net.wifi.IWifiManager$Stub$Proxy.setWifiApEnabled(IWifiManager.java:1525)
        at android.net.wifi.WifiManager.setWifiApEnabled(WifiManager.java:1600)
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.mady.wifi.api.WifiHotSpots.startHotSpot(WifiHotSpots.java:430) 
        at de.martinreinhardt.cordova.plugins.hotspot.HotSpotPlugin.createHotspot(HotSpotPlugin.java:783) 
        at de.martinreinhardt.cordova.plugins.hotspot.HotSpotPlugin$7.run(HotSpotPlugin.java:249) 
        at de.martinreinhardt.cordova.plugins.hotspot.HotSpotPlugin$31.run(HotSpotPlugin.java:1003) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
        at java.lang.Thread.run(Thread.java:761) 

Seems a permission bug.

RafayelArmeni commented 6 years ago

So I faced with the same issue but I fixed it so In android 6.0 and 7.0 there is "Modify system settings" or "Apps that can change system settings" . You have to enable that setting to give permission for wifi hotspot to make changes. system settings