Wednesday, March 28, 2012

[android-developers] Access Point Change detection

favorite
share [g+] share [fb] share [tw]

Hello,

My application has to open a socket and send/receive some message to
the server. This works fine but the problem is when I move inside the
building, then the device changes from one access points to the other
(same wifi network). In that moment, I have (1) to store the messages,
(2) create again the socket and (3) send stored messages. I not able
to recognize that moment and I am not storing all the messages. I
detect "A Connection timed out" exception in the BufferedReader and
then I start storing messages.

I have tried to detect that moment by this registering to this Intents
but I am still missing messages:

//To detect Connectivity changes.
cmIntent.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
cmReceiver = new connectionChangeReceiver();
context.registerReceiver(cmReceiver, cmIntent);
intentFilter intentFilter = new IntentFilter();
intentFilter.addAction(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION);
intentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
intentFilter.addAction(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION);
context.registerReceiver(cmReceiver, intentFilter);

Thank you so much

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment