android-wifi

how to install CA certificate programmatically on Android without user interaction

拈花ヽ惹草 提交于 2019-11-27 17:45:02
I'm trying to install certificates without prompting the user. I know this is not good practice, but that's what PM wants. Using KeyChain.createInstallIntent() , I can get Android to launch the certificate installation dialog by calling startActivity . However, when I pass the intent to sendBroadcast , nothing happens. Maybe the platform doesn't support this for security reasons? String CERT_FILE = Environment.getExternalStorageDirectory() + "/test/IAT.crt"; Intent intent = KeyChain.createInstallIntent(); try { FileInputStream certIs = new FileInputStream(CERT_FILE); byte [] cert = new byte[

Send request over Mobile data when WIFI is ON.(Android L)

ぃ、小莉子 提交于 2019-11-27 17:27:24
SDK: Android 5.0.1. Android build: LRX22C. Device : Nexus 5. Problem: KITKAT(4.4.4) and below API's 1) startUsingNetworkFeature(int networkType, String feature) This method is deprecated. Deprecated in favor of the cleaner requestNetwork(NetworkRequest, ConnectivityManager.NetworkCallback) . 2) requestRouteToHost(int networkType, int hostAddress) This method is deprecated. Deprecated in favor of the requestNetwork(NetworkRequest, ConnectivityManager.NetworkCallback) , setProcessDefaultNetwork(Network) and getSocketFactory() . were used to send request over Mobile Data Network when WIFI and

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

筅森魡賤 提交于 2019-11-27 15:59:22
问题 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. 回答1: 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

Can I find the MAC address of my Access point in Android?

ぐ巨炮叔叔 提交于 2019-11-27 13:11:11
Can my Android app find the MAC address of the Wifi access point it is connected to? The docs for android.net.wifi.WifiInfo getMacAddress() don't provide any details. See http://developer.android.com/reference/android/net/wifi/WifiInfo.html#getMacAddress() . I'm assuming this is the Mac address of my phone. Can I find the Mac address of the access point? getBSSID() of WifiInfo class will return MAC address of remote access point. BSSID explained here . The following method will return the MAC address of the access point, null if there is no network currently connected. public String getMacId()

how to Send string from Android to PC over wifi

こ雲淡風輕ζ 提交于 2019-11-27 10:58:32
Hello i am working on an android app which requires to send a string over wifi to PC resulting in simulating keyboard keypresses.Any ideas how i can achieve this task ? You would have to write a server program on the PC and use a ServerSocket to accept a connection from and write a thread for your Android phone that uses a regular socket (with the same port as the PC end) and then manage them using DataInputStream and DataOutputStream. You also need to open permissions on your AndroidManifest.xml. For the permissions use this: <uses-permission android:name="android.permission.ACCESS_WIFI_STATE

Listening WIFI state

北城以北 提交于 2019-11-27 07:00:16
问题 I want to set listener to listen on wireless state,can anyone help me with my code import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; ... TelephonyManager wTelephonyManager; ... wTelephonyManager=(TelephonyManager)getSystemService(Context.WIFI_SERVICE); wTelephonyManager.listen(new PhoneL(),PhoneStateListener.LISTEN_DATA_CONNECTION_STATE); connManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); //here is the event that i use that i want

Wifi scan results broadcast receiver not working

心已入冬 提交于 2019-11-27 06:54:52
问题 I have written a simple broadcast receiver to show a toast message when wifi scan is completed. Nothing is showing. Here is my code: package com.wifi; import java.util.List; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.net.wifi.ScanResult; import android.net.wifi.WifiManager; import android.widget.Toast; public class wifiReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent

Getting WiFi signal strength in Android

别来无恙 提交于 2019-11-27 06:53:07
I can get WiFi signal level in dBm using following code. for (ScanResult result : wifiScanResultList) { int signalLevel = result.level; } It gives negative value. When we see the default system WiFi setting and clicked on the connected WiFi network, it gives "Good" or "Bad" as signal strength. What is the range that we can filter those negative vales as "Good" signal strength or "Bad" signal strength? Alan its an old post but this might help someone... WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); int numberOfLevels = 5; WifiInfo wifiInfo = wifiManager

Android M: Unable to remove WIFI AP programmatically

感情迁移 提交于 2019-11-27 06:45:43
问题 In Android M: I am using below code to remove current connected WIFI AP. void RemoveConnectedNetwork(){ int ID=_wifiManager.getConnectionInfo().getNetworkId(); Log.d("test", "network id = ["+ID+"]"); boolen ret =_wifiManager.removeNetwork(ID); Log.d("test", "removeNetwork return ="+ret); _wifiManager.saveConfiguration(); } but RemoveConnectedNetwork() always returns false . Although this API was working well in previous releases. Any solution that can be achieved on this using any other API

Android: How To: display a map (still image file) with a moving current location pointer

独自空忆成欢 提交于 2019-11-27 06:30:36
问题 I am trying to create a prototype that could guide a person to his destination place. place is a wide building with several floors. i can obtain/retrieve the maps (still images). e.g. current:1F destination:5F; so I can get the still images of 1st,2nd...5th floors (5 image files). Scenario: start the application input the current location (or may automatically set using current location) & destination click the search route button to search the maps to use (still images) & mark the current