android-wifi

Android: Programmatically Turn on WiFi hotspot

夙愿已清 提交于 2019-11-29 07:19:01
I am trying to turn on the portable Wifi hotspot ON, by referring this link: how to set advanced settings of android wifihotspot This is working well on Samsung Galaxy S3 Android v4.4.2.(no issues) But on other devices with the same or lower Android version, the application crashes and restarts the device. The code is as follows: package com.android.startwifi; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import android.app.Activity; import android.content.Context; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiManager; import

Data transfer between two Wifi devices

女生的网名这么多〃 提交于 2019-11-29 03:44:11
问题 I have searched in Google. In Android 2.2 and sdk 8 how can I use SSID in a List in Android ? By using SSID should get specific wifi enabled device properties by programmatically. With that help, should transfer the data between two Wifi enabled devices in Android. 回答1: To send data in a meaningful manner between two Android devices you would use a TCP connection. To do that you need the ip address and the port on which the other device is listening. Examples are taken from here. For the

Android - Detect if Wifi Requires Browser Login

随声附和 提交于 2019-11-29 02:24:57
问题 My university has an open wifi access point, however it requires you to enter your e-mail before it allows you to use the web. My problem is that the Wifi is stupid in that it seems to drop my connection and force me to enter my e-mail again every 10 minutes. I wanted to create my own app that I can use to automatically do this step for me, but I cannot seem to find any documentation for a nice and easy way to detect if a Wifi access point has a browser login page. Is there a way in Android

Set static IP and gateway programmatically in Android 6.x (Marshmallow)

早过忘川 提交于 2019-11-29 01:28:25
Can anybody tell me how can I set the static IP and gateway programmatically in Android 6? I have read here and here . Settings.System is not working anymore and goolgle says WIFI_STATIC_IP was deprecated in API level 17 and Use WifiManger instead. Unfortunately I cannot find anything about it in WifiManger and WifiConfiguration classes. Since there's no official API I have to come up with a solution by modifying samples from the following code snipet and this answer . This solution works on devices from Lollipop upwards. @SuppressWarnings("unchecked") public static void

WIFI_STATE_CHANGED_ACTION intent not received upon connection to WiFi access point?

帅比萌擦擦* 提交于 2019-11-29 00:01:33
Part of my app's functionality is to scan and display a list of WiFi access points, and then connect to the one chosen by the user. I have this functionality working. Now, I also wish to be notified when the connection "goes through". This should be fairly simple, but I find myself stumbling. I have read through various posts here at SO, and they all mention registering for WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION or WifiManager.WIFI_STATE_CHANGED_ACTION . However, neither of these works for me. Can anyone spot any mistake in this code? (I am leaving out the parts which do the scan and

Android 5.0 Lollipop and 4.4 KitKat ignores my WiFi network, enableNetwork() is useless

荒凉一梦 提交于 2019-11-28 22:27:42
问题 My app connect directly to a hardware device that act as an access point (with no access to internet). I can't connect because Android 5.0 automaticcaly switch to a valid internet connection, so if I have data connection (3G, 4G, ...) or a pre-configured network I can't connect to my device because it ignores the WiFi. So how can I force Android to use the network I activated programatically? I'm simply using: wifiManager.enableNetwork(id, true)) where id is the network of my device I want to

How to get the coarse location using Wifi or GSM or GPS, whichever is available?

a 夏天 提交于 2019-11-28 20:43:26
My app only needs a coarse location service when started up. In detail, I need the app's rough location so as to provide the users with the shop info nearby. The location does NOT need to be updated constantly. In addition, coarse localization will be sufficient in this case. I wish the app to choose GSM, or wifi, or GPS automatically, whichever is available. The location service should also be one-time to save phone energy . How may I do that? I have tried using GPS separately. My problem is I don't know how to stop the constantly-refreshing-location feature of GPS. I don't know how to make

connect to android devices using wifi direct without prompt

戏子无情 提交于 2019-11-28 19:53:40
i am trying to connect two android devices using WIFI direct and i was successful. But the problem is the second device has to accept the a connection prompt after the other device initiates the connection. It is undesirable for what i am trying to achieve. I saw a few post here in stack overflow itself saying that currently its not possible. But came across an app called SUPERBEAM which user WIFI direct but without the prompt. A search in google gave me the following link from xda forum which says SuperBeam creates an access point using Android's WiFi direct API's. This essentially works like

How to forget a wireless network in android programmatically?

落爺英雄遲暮 提交于 2019-11-28 17:54:30
I am working on an app which wifi , where user will be asked to enter password for the scanned network he selects, if user enters a correct password, it connects and works well. But when user enters wrong password, a new network is added with that name, and will be failing to authenticate cos of wrong password, and it will be having authentication problem status. Now if user tries to again scan and select the same network, and enters correct password, it fails to connect even though password now is correct and will have disabled status, since the previous connection is still showing that

android adb turn on wifi via adb [duplicate]

荒凉一梦 提交于 2019-11-28 16:25:11
This question already has an answer here: How to turn off Wifi via ADB? 8 answers My phone has been locked (too many pattern attempts). To unlock I need to enter username and password on my gmail account. This is the only way I can unlock it. I cant launch any activities, even to turn on wifi connection. Without internet connection I can't sign in to restore my phone. Maybe there is any command in adb to turn on my wifi connection, so I can use my phone? This works really well for and is really simple adb -s $PHONESERIAL shell "svc wifi enable" WiFi can be enabled by altering the settings.db