Re: [android-developers] Re: Wakelock when using startActivityForResult()
Ya I m able to see in Logcat. On Thu, Feb 7, 2013 at 3:48 PM, skink wrote: > > > Archana r wrote: > > I have a class Globals: > > > > ¿and do you see in the logcat: > > "Wake lock is > acquired successfull " > > ? > > pskink > > -- > -- > 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 unsubscribe from this group and stop receiving emails from it, send an > email to android-developers+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Regards, Archana -- -- 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 unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Re: Wakelock when using startActivityForResult()
I have a class Globals: class Globals{ public static WakeLock myWakeLock = null; public static WifiLock myWifiLock = null; } In my ConnectService, onCreate() method, I acquire the wakelock using: wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "My Lock"); if(!wakeLock.isHeld()&&(wakeLock!=null)){ Log.d(TAG,"Wake lock is acquired successfull "); wakeLock.acquire(); Globals.myWakeLock = wakeLock; } I release it only in the onDestroy() of ConnectService: try{ if(Globals.myWakeLock!=null){ Globals.myWakeLock.release(); Globals.myWakeLock = null; Log.d(TAG,"WakeLock released successfully in onDestroy () method her"); } }catch(Exception e){ e.printStackTrace(); Log.d(TAG,"Exception while releasing WakeLock :: Can be ignoredd"); } On Thu, Feb 7, 2013 at 2:52 PM, skink wrote: > i asked "so how do you acquire the wake lock"? > > i mean your java code > > pskink > > -- > -- > 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 unsubscribe from this group and stop receiving emails from it, send an > email to android-developers+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Regards, Archana -- -- 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 unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Re: Wakelock when using startActivityForResult()
I acquire WakeLock in onCreate() of ConnectService and release it only in onDestroy() of ConnectService. On Wed, Feb 6, 2013 at 3:05 PM, skink wrote: > > > Archana r wrote: > > Yes it is :) > > > > ConnectService runs HTTP server in the phone. Initially, when Start > button > > is pressed, the script is HTTP Posted to the client. To execute the > script, > > this service calls ExecuteScript. > > > > > > so how/when/where do you acquire the wake lock? > > pskink > > -- > -- > 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 unsubscribe from this group and stop receiving emails from it, send an > email to android-developers+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Regards, Archana -- -- 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 unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Re: Wakelock when using startActivityForResult()
Yes it is :) ConnectService runs HTTP server in the phone. Initially, when Start button is pressed, the script is HTTP Posted to the client. To execute the script, this service calls ExecuteScript. On Wed, Feb 6, 2013 at 2:39 PM, skink wrote: > > > a wrote: > > Hi I have acquired WakeLock like given in the link: > > > > > http://stackoverflow.com/questions/11274196/releasing-wakelock-in-different-activity-to-where-it-was-acquired > > (having a class separately and acquired globally).. > > > > My application flow is like: MainActivity->starts a Service when I click > a > > Start button(ConnectService) -> ExecuteScript-> > > ScriptActivity->ScriptService-> ExecuteScript in onActivityResult() > sends a > > broadcast to ConnectService() where I have defined onReceive() method.. > > > > The Wakelock is released in onDestroy() of ConnectService(basically when > I > > close my app using a Stop button).. > > > > > > hmmm, what is ConnectService? it seems to me that your code flow is > overcomplicated... > > pskink > > -- > -- > 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 unsubscribe from this group and stop receiving emails from it, send an > email to android-developers+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Regards, Archana -- -- 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 unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Re: Wakelock when using startActivityForResult()
Hi, I have integrated the code(ScriptActivity and ScriptService from SL4A into my project to execute PythonScripts in Android).. So I have ExecuteScript-> ScriptActivity->ScriptService ... On Wed, Feb 6, 2013 at 1:24 PM, skink wrote: > > > a wrote: > > Hi, An update to my question here: > > > > I have some code that gets executed when the screen is on, but when I > power > > off the screen, has some problems in execution(even after acquiring > > Wakelock globally). I have a service that acquired a wakelock and calls > the > > activity - ExecuteScript with the following code: > > > > ExecuteScript.java: > > > > Intent intent = new Intent(this,ScriptActivity.class); > > intent.putExtra("code",code); > > intent.putExtra("type", type); > > startActivityForResult(intent,REQUEST_CODE); > > why does ExecuteScript start ScriptActivity? > > why doesnt ExecuteScript start a service itself? > > pskink > > -- > -- > 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 unsubscribe from this group and stop receiving emails from it, send an > email to android-developers+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Regards, Archana -- -- 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 unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [android-developers] Re: Http Response inside a service in Android
I did not get your question. The script stores the result in a file in internal memory. Is that what you are asking? On Thu, Jan 3, 2013 at 2:49 PM, skink wrote: > > > a wrote: > > The extras that I pass to intent A are the script to be executed and its > > type, both being String. > > > > I was asking about out extras not in extras > > pskink > > -- > 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 > -- Regards, Archana -- 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
Re: [android-developers] Re: Http Response inside a service in Android
My requirement is to have a service running and do a HTTP Post of a file to a device. In the handler for POST, I call an intent(using III party library) which executes scripts(and obtains results) and sends Broadcast message to my service. In the broadcast receiver, I update the new contents and post it back. I want to define the response for POST in Broadcast receiver, so that old copy of the file gets deleted in the device. Let me know if you need details. Thanks! On Thu, Jan 3, 2013 at 12:30 PM, skink wrote: > > > a wrote: > > To execute scripts using Third party library which returns a result. > > Basically I want to send a response for HTTP Post in the Broadcast > > Receiver. Please let me know how this can be done? > > > > > > then call third party library directly. > > or is it kind of Service? if so pass some unique id in your intent to > identify your request > > pskink > > -- > 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 > -- Regards, Archana -- 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
Re: [android-developers] Re: Identifying HTTP Get requests in Android
The link contains code where a separate thread is started for each request. Can I use it? Can you please explain your comment? Thanks! On Thu, Dec 27, 2012 at 1:33 PM, skink wrote: > > > Archana wrote: > > Hi, > > > > Does the server in the > > > hc.apache.org/httpcomponents-core-ga/httpcore/examples/org/apache/http/examples/ElementalHttpServer.javawork > > in Android? > > > > When I try to use the constructor, > > > > HttpService(HttpProcessor processor, ConnectionReuseStrategy > connStrategy, HttpResponseFactory responseFactory, > HttpRequestHandlerResolver handlerResolver, HttpParams params) > > > > > > Eclipse says constructor is not defined. Eclipse gives a quick fix to > > change the constructor as: > > > > HttpService(HttpProcessor proc, ConnectionReuseStrategy connStrategy, > HttpResponseFactory responseFactory) > > > > How will I register the handler for my requests in this case? > > > > Thanks in advance! > > > > > > On Wednesday, December 19, 2012 2:18:04 PM UTC+2, skink wrote: > > > > > > > > > > > > Archana wrote: > > > > Hi, > > > > I m implementing threads first. Can I use Basic HTTP server from the > > > > link http://hc.apache.org/httpcomponents-core-ga/examples.html ? > > > > > > > > Can you please let me know the difference between handling blocking > > > > requests and blocking IO(as specified in the link). > > > > > > > > Thanks! > > > > > > > > > > > > > > > > > > after two minute googling I got this: > > > > > > http://www.oracle.com/technetwork/java/socket-140484.html > > > > > > why don't you use Google for a basic socket stuff that has nothing to > > > do with android? > > > > > > pskink > > > > > you had a working single threaded serverthat started like this: > > while(true){ > socket = > serverSocket.accept(); > > why don't you change it to the multi threaded one? > > pskink > > -- > 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 > -- Regards, Archana -- 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