android-wifi

Checking Device has internet connection

蓝咒 提交于 2019-12-14 04:23:25
问题 I followed this Keep checking if Device has internet connection to check internet connectivity using BroadcastReceiver, the problem is how to call this registerReceiver(mConnReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); from main activity 回答1: Try this: if(isNetworkStatusAvialable(getApplicationContext())) { }else { public static boolean isNetworkStatusAvialable(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService

How to obtain amount of transferred data through Wi-Fi from other applications?

廉价感情. 提交于 2019-12-14 03:54:50
问题 I'm facing to this problem. I spent much time by searching some API or "something" with it's possible to obtain transferred data through Wi-Fi from other applications (how screenshot bellow shows). Does someone know a way how to do it? Is here someone who tried (or has already done) for something similar? Or a little differently: Is this possible to do it? Currently i think that this is not possible because i think that non-system application cannot retrieve data from other application(s)

alarm dialog for turn on wifi

一个人想着一个人 提交于 2019-12-13 21:12:59
问题 I am new in android programming. I searched on the internet but i can't find any solution, maybe for this i have not good english. anyway. When user clicked on the web link i want to show an alarm dialog to user that turn on wifi, and then user clicked on the OK button, wifi settings is shows. This is my TextView with link: <TextView android:id="@+id/sitename" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/site2" android:background="@color/white

Lauching a task when WIFI connects on Android Oreo or newer

て烟熏妆下的殇ゞ 提交于 2019-12-13 20:23:47
问题 I have an app that run some security checks and alerts the user using notifications when the device connects to a WIFI network with an specific SSID. The app run checks in background and if there is some security issue alerts the user using notifications. The issue is that I was using a broadcast receiver for this but with Android Oreo or newer is not working any more. I was reading a lot and I can't find a way for running some background action exactly when the WIFI connection is turned on.

SecurityException when getting Wifi Scan Results

我是研究僧i 提交于 2019-12-13 14:28:14
问题 I'm working with Android Studio on an app that, when I push a button, gives me the results of wifi scan! If I test the code alone (only the part "wifi scan") it works... But when I put it in the complete app, the app crashs! Why? I post my code: //MAIN package com.example.pc1.tesiprova; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget

How can I enforce internet connection only through wifi?

给你一囗甜甜゛ 提交于 2019-12-13 10:33:07
问题 We have a Wifi-connected device. We need to connect to the device via wifi for installation. Once connected, the application sends the request on a ip. This works smoothly before android 9. But I'm having some problems when I do with android 9. Because when i connect to device i getting error message like this: wi-fi has no internet acces. And requests continue on mobile data. So app can't talk with device. Can i doing something about this problem? 回答1: I guess this is related to permissions

Android: location detection by Cellular Network and WiFi

倖福魔咒の 提交于 2019-12-13 03:18:30
问题 I would like to build a app which will provide current location using cellular Network and WiFi . I like to get location from both provider simultaneously and then decide which provider give me best. Now i am getting location from Network LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); LocationListener locationlistenerforNetwork = new mylocationlistenerNetwork(); lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationlistenerforNetwork);

Adding an Android WiFi connection results in -1

爱⌒轻易说出口 提交于 2019-12-13 00:40:56
问题 I am trying to create a wi-fi connection from a scan result. The only advertised capability is ESS and it is a network with no security details. WifiConfiguration wc = new WifiConfiguration(); wc.SSID = result.SSID; wc.BSSID = result.BSSID; //No password. it should be an open network wc.status = WifiConfiguration.Status.ENABLED; wc.priority = 100000; wc.hiddenSSID = false; int netId = mainWifi.addNetwork(wc); if (netId == -1) { showMessageDialog("Error connecting to network."); return; }

android intent not work for wifi,sound,bluetooth?

拜拜、爱过 提交于 2019-12-12 22:15:21
问题 I'm try to call setting which display WiFi,sound and bluetooth but is not work: i will put my code here and also logcat i want this settings on button click event and display only selected icons if any other way to use this i want to use like see image here @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.wifi); Button wifi =(Button)findViewById(R.id.wifi); wifi.setOnClickListener(new OnClickListener() { public void

Get android device name defined by user over wifi

泪湿孤枕 提交于 2019-12-12 10:25:26
问题 In my Android app I want to detect all Android device names found in the local wireless network. I am able to scan the network and find the devices IP and full qualified domain name (FQDN) like android-2120ee3b45****** . I'm doing it like: final InetAddress inetAddress = InetAddress.getByName(ip); if (inetAddress.isReachable(400)) { final String host = inetAddress.getHostName(); final String canHost = inetAddress.getCanonicalHostName(); final String ip = inetAddress.getAddress(); } With java