android-wifi

Multicast Support on Android in Hotspot/Tethering mode

╄→尐↘猪︶ㄣ 提交于 2019-12-03 11:48:52
问题 I have a prototype Android app that is listening for multicast packets to 'discover' clients to communicate with. The socket set up is similar to this: InetAddress group = InetAddress.getByName("228.1.2.3"); MulticastSocket s = new MulticastSocket(4000); s.joinGroup(group); This works very well when all the devices are connected via WiFi. I would like to support this with the phone acting as a portable hotspot. However, while all my devices appear to connect to the hotspot correctly I no

Change WiFi hotspot's SSID and password in Android Oreo 8.x

心不动则不痛 提交于 2019-12-03 09:40:23
In my Android application I'm using the following code snippet: @RequiresApi(api = Build.VERSION_CODES.O) private void turnOnHotspot(){ WifiManager manager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE); manager.startLocalOnlyHotspot(new WifiManager.LocalOnlyHotspotCallback(){ @Override public void onStarted(WifiManager.LocalOnlyHotspotReservation reservation) { super.onStarted(reservation); Log.d(TAG, "Wifi Hotspot is on now"); } @Override public void onStopped() { super.onStopped(); Log.d(TAG, "onStopped: "); } @Override public void onFailed(int reason) {

Connect android to two wireless networks simultaneously

依然范特西╮ 提交于 2019-12-03 09:30:45
问题 I want to make my android connects two networks at the same time, the first one a wifi network to get internet connection and the other one ad-hoc network ( a network between mobiles to share some data), but the android can join only one network at the same time, Any ideas!! 回答1: What you are asking for can not currently be done. You can only be connected to one network at the time. However, there is a standard called WiFi direct that will allow you to do what you are asking for, but it isn't

how to get Distance between wifi access point and Mobile Device

余生长醉 提交于 2019-12-03 09:11:37
i am developing an android application which have module to search all nearest / detected wifi hotspot. i can get all detail from searched wifi hotspot like, SSID, BSSID, capabilities, frequency, level and timestamp with these information, i also need Distance of wifi ( The distance between wifi accesspoint and Mobile Device ) i am using below lines to get Distance. double exp = (27.55 - (20 * Math.log10(freqInMHz)) + Math.abs(levelInDb)) / 20.0; double distanceM = Math.pow(10.0, exp); this will return distance in meter. i got these code by reserch on google from many pages. but i think i am

Facebook app type no internet connection message

℡╲_俬逩灬. 提交于 2019-12-03 08:52:33
How can I show no internet connection message like in facebook app that appears below the tab view. Aboulfotoh You can design this in your XML file and then set its visibility to invisible like this: <RelativeLayout android:id="@+id/relativelayout_connection" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:alpha="0.8" android:background="@android:color/black" > <TextView android:id="@+id/textView_noInternetConnection" android:layout_width="wrap_content" android:layout_height="wrap

How can i check my android device support wifi direct?

牧云@^-^@ 提交于 2019-12-03 08:51:45
问题 I am working with android wifi direct demo application. After installation in my device I noticed that it is not working as expected. I am confused, does my device support wifi direct or special hardware feature required for wifi direct? My device is local walton brand and API level 16. After reading android documentation i know that Wi-Fi Direct added in API level 14 doesn't need a wireless access point. My other question is if in a place where no wifi zone is created using wifi direct two

Get IP from wifi hotspot in android

梦想与她 提交于 2019-12-03 08:37:12
I want to get IP of wifi hotspot (from another computer) that android device connect via wifi, not IP local of android . I run application in real device . I can scan all wifi and get name of them. public class WifiConnectorActivity extends Activity { TextView mainText; WifiManager mainWifi; WifiReceiver receiverWifi; List<ScanResult> wifiList; StringBuilder sb = new StringBuilder(); /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mainWifi = (WifiManager

How to programmatically install a CA Certificate (for EAP WiFi configuration) in Android?

不想你离开。 提交于 2019-12-03 08:16:25
My objective: Create an EAP WiFi configuration - including the CA Certificate - in Android programmitcally. Problem: How do I install a CA Certificate programmatically (and then reference that certificate in the EAP WiFi configuration)? I found a very useful link already that allows me to create and save EAP WiFi configurations here: How to programmatically create and read WEP/EAP WiFi configurations in Android? However this assumes that you have already installed the CA Certificate on the device. I would like to install the certificate within my app - either from the resources in the app, or

Creating WPA2 PSK Access Point in Android Programmatically

五迷三道 提交于 2019-12-03 08:00:37
问题 I want to create Access Point in android programmatically with the following configurations. AccessPointName :SomeName Security:WPA2 PSK Password:SomeKey How can i do that? Regards 回答1: I had faced this problem once. In order to create a WPA2 PSK access point, you need to populate the WifiConfiguartion object with your WPA2 PSK parameters. However I could not find a way to set KeyManagement as WPA2_PSK . There was only options for WPA_PSK , IEEE8021X , WPA_EAP and NONE . Then I read the

Get Android WiFi “net.hostname” from code

半城伤御伤魂 提交于 2019-12-03 07:52:35
问题 When an Android device connects to a wifi AP, it identifies itself with a name like: android_cc1dec12345e6054 How can that string be obtained from within an Android app? Not for the purpose of changing it, just for readout. EDIT: This is a screenshot of my router's web interface, showing a list of all connected devices. Note the two Android devices on the list -- How can that string be read from Java code running on the device? 回答1: Building off of @Merlevede's answer, here's a quick and