[android-developers] Re: Access Point Change detection
Thank you for your help, in my case is a Nexus One v2.3.6 (a bit old) and I have been doing a bit more of testing, this is the logcat when the access point change: 03-29 08:33:12.890 I/wpa_supplicant( 934): CTRL-EVENT-DISCONNECTED - Disconnect event - remove keys 03-29 08:33:12.890 V/WifiMonitor( 96): Event [CTRL-EVENT- DISCONNECTED - Disconnect event - remove keys] 03-29 08:33:12.890 V/WifiStateTracker( 96): New network state is DISCONNECTED 03-29 08:33:12.900 I/wpa_supplicant( 934): CTRL-EVENT-STATE-CHANGE id=1 state=0 BSSID=00:00:00:00:00:00 03-29 08:33:12.900 V/WifiMonitor( 96): Event [CTRL-EVENT-STATE- CHANGE id=1 state=0 BSSID=00:00:00:00:00:00] 03-29 08:33:12.900 V/WifiStateTracker( 96): Changing supplicant state: COMPLETED == DISCONNECTED 03-29 08:33:12.900 D/ARIADNA ( 606): connectionChangeReceiver - SUPPLICANT_STATE_CHANGED_ACTION 03-29 08:33:12.900 D/ARIADNA ( 606): Stop Socket and start buffering... The problem is that the last message received by the server is on 08:32:54 after that 10 messages are sended but not received (before the broadcast received). ¿Is there any way to detect if the message has arrive to the server? ¿Other way to test connectivity or test the server? this is the way I implement the socket: sock = new Socket(); sock.bind(null); InetSocketAddress isa = new InetSocketAddress(serverIPAddress,serverPort); sock.connect(isa, conectionTimeOut); sock.setKeepAlive(true); isR = new InputStreamReader(sock.getInputStream(), UTF8); reader = new BufferedReader(isR); out = new BufferedWriter(new OutputStreamWriter(sock.getOutputStream(), UTF8)); Thank you so much On 29 mar, 00:52, Irfan Sheriff isher...@gmail.com wrote: It would be good to know if there are devices beyond ICS that still have issues around not resetting socket connections when a network goes away. Beyond ICS? I don't know what this means. My flagship Galaxy Nexus still hasn't received 4.0.3. And what do you mean by would be good to know? Should we, developers, and our users, moonlight as Android's test department? I think we dont have a CTS around this behavior. I will look at filing a bug internally for this to ensure things remain sane going forward. Thanks Ideally, apps should not have to listen to any broadcasts to handle network switches and should get resets on an existing socket. Not ideally -- really -- apps are supposed to work on more than the 1.6% of devices with ICS. And beyond ICS - what portion of the market is that, at this time, exactly? -- K Irfan -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Access Point Change detection
Thank you for your help, in my case is a Nexus One v2.3.6 (a bit old). Theoretically the socket should continue working anyway and application should not stop ant start again the socket? I have been doing a bit more of testing, this is the logcat when the access point change: 03-29 08:33:12.890 I/wpa_supplicant( 934): CTRL-EVENT-DISCONNECTED - Disconnect event - remove keys 03-29 08:33:12.890 V/WifiMonitor( 96): Event [CTRL-EVENT- DISCONNECTED - Disconnect event - remove keys] 03-29 08:33:12.890 V/WifiStateTracker( 96): New network state is DISCONNECTED 03-29 08:33:12.900 I/wpa_supplicant( 934): CTRL-EVENT-STATE-CHANGE id=1 state=0 BSSID=00:00:00:00:00:00 03-29 08:33:12.900 V/WifiMonitor( 96): Event [CTRL-EVENT-STATE- CHANGE id=1 state=0 BSSID=00:00:00:00:00:00] 03-29 08:33:12.900 V/WifiStateTracker( 96): Changing supplicant state: COMPLETED == DISCONNECTED 03-29 08:33:12.900 D/ARIADNA ( 606): connectionChangeReceiver - SUPPLICANT_STATE_CHANGED_ACTION 03-29 08:33:12.900 D/ARIADNA ( 606): Stop Socket and start buffering... The problem is that the last message received by the server is on 08:32:54 after that 10 messages are sended but not received (before the broadcast received). ¿Is there any way to detect if the message has arrive to the server? ¿Other way to test connectivity or test the server? this is the way I implement the socket: sock = new Socket(); sock.bind(null); InetSocketAddress isa = new InetSocketAddress(serverIPAddress,serverPort); sock.connect(isa, conectionTimeOut); sock.setKeepAlive(true); isR = new InputStreamReader(sock.getInputStream(), UTF8); reader = new BufferedReader(isR); out = new BufferedWriter(new OutputStreamWriter(sock.getOutputStream(), UTF8)); Thank you so much On 29 mar, 00:52, Irfan Sheriff isher...@gmail.com wrote: It would be good to know if there are devices beyond ICS that still have issues around not resetting socket connections when a network goes away. Beyond ICS? I don't know what this means. My flagship Galaxy Nexus still hasn't received 4.0.3. And what do you mean by would be good to know? Should we, developers, and our users, moonlight as Android's test department? I think we dont have a CTS around this behavior. I will look at filing a bug internally for this to ensure things remain sane going forward. Thanks Ideally, apps should not have to listen to any broadcasts to handle network switches and should get resets on an existing socket. Not ideally -- really -- apps are supposed to work on more than the 1.6% of devices with ICS. And beyond ICS - what portion of the market is that, at this time, exactly? -- K Irfan -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Access Point Change detection (WiFi)
0 down vote 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Android adb permision error
Thank you so much introducing yours works!! This is, including OWNER and GROUP values On 21 mar, 15:27, Kostya Vasilyev kmans...@gmail.com wrote: FWIW, I remember seeing this with some (not all) of mydevices, even when my UPnP ids were correct. To fix, I specified my actual user and group to the udev file, like this: SUBSYSTEM==usb, ATTR{idVendor}==0bb4, MODE=0666, OWNER=kman, GROUP=kman ... changing from the usual GROUP=plugdev (IIRC) in the documentation. -- K 21 ÍÁÒÔÁ 2012 Ç. 18:14 ÐÏÌØÚÏ×ÁÔÅÌØ Chris Stratton cs07...@gmail.com ÎÁÐÉÓÁÌ: Is the content of your udev rules file correct, and will it match the device you are connecting? Ie, post the content of your rules file. On Tuesday, March 20, 2012 7:59:49 AM UTC-4, Hera wrote: Hello, I have installed the android SDK but I'm getting an error when using a hardware device, executing ./adbdevice$ I get this error: List ofdevicesattached no permissions While if I execute sudo ./adbdevice there is no error: List ofdevicesattached HT019P80XXX device Adbmust work for all users (also when eclipse starts it) but It only works as root. The permissions of the related files are: -rwxr-xr-x 1 root root 72 2012-03-20 09:53 /etc/udev/rules.d/51- android.rules -rwxr-xr-x 1 ariadna ariadna 159620 2012-03-19 13:45adb I have googled and tried different solutions but none off then works on my Ubuntu, any idea? Thank you -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Android adb permision error
Hello, I have installed the android SDK but I’m getting an error when using a hardware device, executing “./adb device$ I get this error: List of devices attached no permissions While if I execute “sudo ./adb device” there is no error: List of devices attached HT019P80XXX device Adb must work for all users (also when eclipse starts it) but It only works as root. The permissions of the related files are: -rwxr-xr-x 1 root root 72 2012-03-20 09:53 /etc/udev/rules.d/51- android.rules -rwxr-xr-x 1 ariadna ariadna 159620 2012-03-19 13:45 adb I have googled and tried different solutions but none off then works on my Ubuntu, any idea? Thank you -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] GPS information with logcat
Hello, I’m trying to see if the assistance data is injected into the GPS by examining the logcat but I’m not able to know where the problem is. As I can see in logcat messages, Android fist tries to connect with the SUPL server but it fails, whereas the NTP time injection is well done. Finally, a xtra data download request is done (my devices has a Qualcomm chip) but there is no message to see whether it is well done or not. Logcat messages: // SUPL A-GPS D/GpsLocationProvider( 96): set_capabilities_callback: 7 D/ lib_locapi( 96): loc_eng_init called, client id = 0 D/ lib_locapi( 96): loc_eng_set_default_agps_server, type = 1, hostname = supl.google.com, port = 7276 D/lib_locapi( 96): loc_eng_process_deferred_action started D/lib_locapi( 96): Setting GPS privacy lock to RPC_LOC_LOCK_NONE D/lib_locapi( 96): loc_eng_set_gps_lock mode, client = 0, lock_type = 1 D/lib_locapi( 96): loc_eng_set_gps_lock mode failed // NTP D/GpsLocationProvider( 96): NTP server returned: 1306739478749 (Mon May 30 09:11:18 GMT+02:00 2011) reference: 38652 certainty: 73 system time offset: 12419 D/lib_locapi( 96): loc_eng_inject_time, uncertainty = 73 // XTRA DATA Qualcomm D/lib_locapi( 96): loc_event_cb: xtra download requst Is there any way to get more information related with the GPS behavior? I have made another simple test with other device (same model but early android version and different applications running) and I am able to see more information related with the xtra data injection: D 96/GpsLocationProvider: calling native_inject_xtra_data D 96/GpsLocationProvider: Acquiring wakelock D 96/libgps: qct_gps_inject_xtra_data length: 39635 parts: 100 I do not understand the reason why the logcat is different and has more information, any idea? Any help will be appreciated Thank you -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: GPS information with logcat
Thank you Ibendlin but both devices are Nexus One (differente ANDROID versión) therefore I think that I am misleading something when I get the logcat messages. On 20 dic, 14:34, lbendlin l...@bendlin.us wrote: this is totally depending on the GPS chipset implementation in each device. You will have to raise your question with the device manufacturers. -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Binding a remote service through the application class
Let me see if I have understood: I have to create a Bound service by Extending the Binder class, this is a local service. Then, the service must start a normal Thread (new runnnable) to do the work or is better to implement it in another way? On 28 sep, 17:07, Mark Murphy mmur...@commonsware.com wrote: On Wed, Sep 28, 2011 at 11:04 AM, Hera aide...@gmail.com wrote: I think that my service must be implemented in a separate process because it implements a CPU intensive work and it used to block the GUI when I used AsyncTask to refresh the GUI, maybe there is other alternatives. You need a background *thread*, not a *process*: http://developer.android.com/guide/topics/fundamentals/processes-and-... -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android App Developer Books:http://commonsware.com/books -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Binding a remote service through the application class
Hello, I am developing an application compose by: 4 activities, one application class (Global) and a remote service with provides the data shown in the active activity (the same data is needed for all activities). The application class (Global) is where I define and interact with objects that are used by all the activities. Moreover, as it is only instantiated ones at the beginning of the application, I also do things that must be done only once: opening a database at the beginning (the same database is used by both, the remote process and the activities). As the data returned by the remote service must be redirected to the current activity, I bindService() and receive the data from the service in the Global class. I start the service in the onCreate of Global class in order to get the data as soon as possible. I thought that this Global class was only instantiated once during the whole application (at the beginning) but when I bindService(), this class is instantiated again. Therefore, the onCreate is again executed and another process is started. Can someone tell me the correct way no do this? Is It possible to define a common class (with common objects) that is only instantiated once and valid for both, activities and the remote service. Another thing that I would like to know is if is better to use Singleton classes or application classes. Thank you very 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Binding a remote service through the application class
Thank you so much, Mark. I am using a bound service in a remote process and I have already solve the comunication between 2 processes (the application shown and the service). I think that my service must be implemented in a separate process because it implements a CPU intensive work and it used to block the GUI when I used AsyncTask to refresh the GUI, maybe there is other alternatives. Any sugerences? The good point of the Application class is that it is instanciated and onCreated before any other component of the application. thank you very much again. On 28 sep, 16:23, Mark Murphy mmur...@commonsware.com wrote: On Wed, Sep 28, 2011 at 10:17 AM, Hera aide...@gmail.com wrote: I am developing an application compose by: 4 activities, one application class (Global) and a remote service with provides the data shown in the active activity (the same data is needed for all activities). You do not need a remote service. The application class (Global) is where I define and interact with objects that are used by all the activities. Moreover, as it is only instantiated ones at the beginning of the application, I also do things that must be done only once: opening a database at the beginning (the same database is used by both, the remote process and the activities). You do not need a remote process. As the data returned by the remote service must be redirected to the current activity, I bindService() and receive the data from the service in the Global class. I start the service in the onCreate of Global class in order to get the data as soon as possible. I thought that this Global class was only instantiated once during the whole application (at the beginning) but when I bindService(), this class is instantiated again. Therefore, the onCreate is again executed and another process is started. That is because you are using a remote process when you do not need one. Get rid of the remote process, and your problem will be solved. Can someone tell me the correct way no do this? Is It possible to define a common class (with common objects) that is only instantiated once and valid for both, activities and the remote service. Make it a local service. Another thing that I would like to know is if is better to use Singleton classes or application classes. A custom Application class does not necessarily give you anything over a singleton. The downside of an Application class is that there can only be one. In particular, I'd never create a library that depended upon a custom Application class, as that library would not be able to work in tandem with other such libraries. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android App Developer Books:http://commonsware.com/books -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: BroadcastReceivers and orientation changes
Thanks Mark, I no sure about the difference between registering the event on the activity or registering it on the application context, can ´t I pass the broadcastReceiver object thought onRetainNonConfigurationInstance() if I made it on the activity? Another problem would be what happends if I have another listener (i.e. GPS location update listenes) in the same activity, with this solution is not posible to pass 2 different objects(listeners) to the onRetainNonConfigurationInstance, any solution? Thank you so much. On 15 jul, 00:14, Mark Murphy mmur...@commonsware.com wrote: Rather than calling registerReceiver() on the Activity, call it on the Application context via getApplicationContext().registerReceiver(). Then, pass the receiver object via onRetainNonConfigurationInstance(), so you unregister the same receiver when you are done. On Thu, Jul 14, 2011 at 7:27 AM, Hera aide...@gmail.com wrote: Hello, I’m having problems with BroadcastReceivers when the screen orientation changes. My Activity registers for receiving WiFi scans with a BroadcastReceiver and when the scan is done: (1) unregisterReceiver(mWifiReceiver), (2) I made some things with the results (by using an AsynkTask thread) and finally, when the thread is finished (3) the activity starts another WiFi scan and the whole process starts again. Everything works fine until a screen orientation changes occurs: If I do not unregisterReceiver() on the onRetainNonConfigurationInstance method I get this exception Activity myActivity has leaked IntentReceiver myActivity $WifiReceiver@405efad0 that was originally registered here. Are you missing a call to unregisterReceiver()? While if I unregisterReceiver(), I get this one: ERROR/AndroidRuntime(1490): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.wifi.SCAN_RESULTS } in myActivity $WifiReceiver@406b4668 Could someone tell me the correct way to manage BroadcastReceiver in screen orientation changes? -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android App Developer Books:http://commonsware.com/books -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] BroadcastReceivers and orientation changes
Hello, I’m having problems with BroadcastReceivers when the screen orientation changes. My Activity registers for receiving WiFi scans with a BroadcastReceiver and when the scan is done: (1) unregisterReceiver(mWifiReceiver), (2) I made some things with the results (by using an AsynkTask thread) and finally, when the thread is finished (3) the activity starts another WiFi scan and the whole process starts again. Everything works fine until a screen orientation changes occurs: If I do not unregisterReceiver() on the onRetainNonConfigurationInstance method I get this exception Activity myActivity has leaked IntentReceiver myActivity $WifiReceiver@405efad0 that was originally registered here. Are you missing a call to unregisterReceiver()? While if I unregisterReceiver(), I get this one: ERROR/AndroidRuntime(1490): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.wifi.SCAN_RESULTS } in myActivity $WifiReceiver@406b4668 Could someone tell me the correct way to manage BroadcastReceiver in screen orientation changes? -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en