Android Studio Error: "Wifi direct has stopped" -
the following code giving error when run on tablet.
not sure if missing anything.
please me.
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.sahgal.robotcontrolapp" android:versioncode="1" android:versionname="1.0"> <uses-sdk android:minsdkversion="14" /> <uses-permission android:name="android.permission.access_wifi_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.internet" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.read_phone_state" /> <uses-permission android:name="android.permission.write_external_storage" /> <!-- google play filtering --> <uses-feature android:name="android.hardware.wifi.direct" android:required="true"/> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@android:style/theme.holo"> <activity android:name=".mainactivity" android:label="@string/app_name" android:launchmode="singletask"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <!-- used transferring files after successful connection --> <service android:enabled="true" android:name=".filetransferservice" /> </application> </manifest>
android 4.0 , later support wifi direct. however, of 4.x devices not support because of wifi driver.
to overcome problem need check device supportable wifi direct or not. checking use code:
objmanager.discoverpeers(objchannel, new actionlistener() { @override public void onsuccess() { //onsuccess } @override public void onfailure(int reason) { //onfailure } });
Comments
Post a Comment