connectivity

Capturing network status change event

不想你离开。 提交于 2019-12-19 09:59:10
问题 I am trying to get events when the internet connection is reestablished after it is lost. It is for a data transfer software that I am developing. If I lose the network during data transfer, I would like to be notified when it is back and continue the transfer automatically. I can of course create a separate thread and check the network once in a while with a timer, but maybe there is a better option out there. I am developing for windows mainly, in C++ (not .net). I can also use wxwidgets (I

Android: Set Bluetooth Discoverability Unbounded

梦想与她 提交于 2019-12-19 04:22:50
问题 I have spent the last couple of days trying to make an app that keeps my Samsung Galaxy S3 mini (Android 2.1.4) discoverable for an "infinite" amount of time. My code looks currently as follows: package com.example.downtoone; import android.app.Activity; import android.os.Bundle; import android.support.v4.content.LocalBroadcastManager; import android.widget.Toast; import com.example.downtoone.*; import android.bluetooth.*; import android.content.BroadcastReceiver; import android.content

Android: Set Bluetooth Discoverability Unbounded

Deadly 提交于 2019-12-19 04:22:24
问题 I have spent the last couple of days trying to make an app that keeps my Samsung Galaxy S3 mini (Android 2.1.4) discoverable for an "infinite" amount of time. My code looks currently as follows: package com.example.downtoone; import android.app.Activity; import android.os.Bundle; import android.support.v4.content.LocalBroadcastManager; import android.widget.Toast; import com.example.downtoone.*; import android.bluetooth.*; import android.content.BroadcastReceiver; import android.content

BroadcastReceiver for CONNECTIVITY_ACTION always returns null in intent.getExtras()

≯℡__Kan透↙ 提交于 2019-12-18 11:32:04
问题 Im trying to receive BroadcastMessages from CONNECTIVITY_ACTION: // register BroadcastReceiver on network state changes final IntentFilter mIFNetwork = new IntentFilter(); mIFNetwork.addAction(android.net.ConnectivityManager.CONNECTIVITY_ACTION); //"android.net.conn.CONNECTIVITY_CHANGE" registerReceiver(mIRNetwork, mIFNetwork); and receiver is: private BroadcastReceiver mIRNetwork = new BroadcastReceiver() { @Override public void onReceive(final Context context, final Intent intent) { android

Programmatically check whether my machine has internet access or not

人盡茶涼 提交于 2019-12-18 05:44:31
问题 How can I programmatically check whether my machine has internet access or not using C/C++, is it just a matter of pinging an IP? How does NIC do it ? I mean something like: I am using Windows 7. 回答1: If you work on Windows, just try this #include <iostream> #include <windows.h> #include <wininet.h> using namespace std; int main(){ if(InternetCheckConnection(L"http://www.google.com",FLAG_ICC_FORCE_CONNECTION,0)) { cout << "connected to internet"; } return 0; } 回答2: There is nothing of that

Programmatically check whether my machine has internet access or not

為{幸葍}努か 提交于 2019-12-18 05:44:15
问题 How can I programmatically check whether my machine has internet access or not using C/C++, is it just a matter of pinging an IP? How does NIC do it ? I mean something like: I am using Windows 7. 回答1: If you work on Windows, just try this #include <iostream> #include <windows.h> #include <wininet.h> using namespace std; int main(){ if(InternetCheckConnection(L"http://www.google.com",FLAG_ICC_FORCE_CONNECTION,0)) { cout << "connected to internet"; } return 0; } 回答2: There is nothing of that

Android emulator no internet connectivity

雨燕双飞 提交于 2019-12-18 05:22:43
问题 I'm running under windows xp sp3 and i have no firewall, no proxy, my internet connection works perfectly but android emulator have no connection (browser and app), i've tried some solutions like this one but infortunately not work. For information, my emulator used to work and this problem occurs suddenly.. Please help with this. Thanks 回答1: Start your from command prompt prompt like your_path_of_android_sdk\tools\emulator -avd <AVD Name> -dns-server 8.8.8.8 I think this will help you out as

Broadcast Receiver and Internet connection

一曲冷凌霜 提交于 2019-12-18 05:21:15
问题 How do I use broadcast receiver to check if there isn't Internet connection? And after that: 1.If there is connection = do nothing 2.There isn't connection = open new activity I hope you understand what I'm asking about. Here is my webview app code: WebView mWebView; String URL = "http://url.com"; ProgressBar loadingProgressBar,loadingTitle; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

How can I determine whether I am connected to WiFi or a mobile network in Windows Phone 8.1 (Universal app)?

天涯浪子 提交于 2019-12-18 05:14:08
问题 I am working with a Windows Universal app (shared backend between Windows 8.1 and Windows Phone 8.1, not Silverlight). The app connects to Azure with Azure Mobile Services. In the settings for the app I would like to have an option for synchronisation to only occur over a WiFi network. How can I determine if the phone is connected to WiFi or a mobile network? Although from my research I have found ways to do this with older versions of Windows Phone and with Silverlight, it seems I can only

How to find connected components in Matlab?

删除回忆录丶 提交于 2019-12-17 09:52:46
问题 array A = 2 3 2 5 4 8 5 6 7 8 I'd like to get the result as 'conidx = [2 3 5 6] and [4 7 8]'. One of the values of [2 3] exists in the 2nd row, One of the values of [2 5] exists in the 4th row, so [2 3], [2 5] and [5 6] are connected, finally I can get the connected indices as [2 3 5 6]. Otherwise, one of the values of [4 8] exists in the 5th row, so [4 8] and [7 8] are connected, finally I can get the connected indices as [4 7 8]. [3]<-->[2]<-->[5]<-->[6] and [4]<-->[8]<-->[7] 回答1: build a