Re: [android-developers] Re: Service or no service
I know how to realize your feature. But I am not sure this is good or not. you can start an alarm manager to check the service is running or nor at some minutes. If the service is being killed, you just start it again. 2010/12/19 TreKing treking...@gmail.com On Sat, Dec 18, 2010 at 4:54 PM, Hans-Erik erikswed...@gmail.com wrote: AsyncTask out the door, Services welcome in. Realize that a Service can just as easily be killed. There's really no such thing as keeping a connection alive. Your process can and will be killed at some point, if not by the system then explicitly by the user. In my Desire phone i see both fring and Google mssagin always running Read some about a service being Sticky AFAIK, sticky means the system will try to restart the Service if it was killed before it was done. This does not guarantee that you will always be running. I read elsewhere that a service can be started with a Brodcastcmmand http://stackoverflow.com/questions/4468006/can-i-start-a-service-without-activity-or-receiver cant wrap my head around the code implementation here. after reading many questions here and elsewhere about this. I think the method is: - an apk file which contains a Service an activity and a BroadcastReceiver Class. - action.BOOT_COMPLETED will start only my Service, not the Activity. The user can from Main Launcher start Activity for in app settings and I Bind to Service and Unbind when done Yes, you can start a service in response to system events, however, I stress again that your Service can and will be killed eventually. You cannot count on it living forever. I look at your TreKing app. Im impressed nice work Thanks :-) Can I ask how did you tap into CTA bus tracker system GPS signal for all there Busses location? They have a whole API for developershttp://www.transitchicago.com/developers/bustracker.aspx . - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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.comandroid-developers%2bunsubscr...@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: Service or no service
That's quite interesting thanks TreKing. That is one approach but dont think it will work for me. On scenario is if 200 phones connect to my server wanting to send one jpg to another phone. 200 messages would go out trough google notifying all phones there is jpg package for them. Google has Limitations in that C2DM about Google limits the number of messages a sender sends in aggregate. Also possible lagging. My initial naive thought was that all those 200 phones could have an app installed that make a connection to me PC server and keep that connection alive. I'm searching for a best way to do do this. What would you do? - Services are bad design and a user might think his battery get drained - Activity with AsyncTask is beautiful if android not killing the app Hmmm (not sure there). One AsyncTask constantely listening for incoming and another AsyncTask gets created when user send jpg. Can an AsyncTask live that long, Is it possible to protect the AsyncTask from onCreate updates, orientationchanges? -- 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: Service or no service
On Fri, Dec 17, 2010 at 1:44 AM, Hans-Erik erikswed...@gmail.com wrote: On scenario is if 200 phones connect to my server wanting to send one jpg to another phone. What are the odds that 200 devices are going to perform the same action at the same time? I guess if you have a significantly large user base, but I'm assuming that's not the case, or is it? 200 messages would go out trough google notifying all phones there is jpg package for them. Google has Limitations in that C2DM about Google limits the number of messages a sender sends in aggregate. Also possible lagging. Is some lagging or some delay in the delivery of these messages completely unacceptable? What is so urgent about these messages that they *must* be received instantaneously? And regardless, there will always be some delay or lagging due to users's network restrictions. My initial naive thought was that all those 200 phones could have an app installed that make a connection to me PC server and keep that connection alive. There's really no such thing as keeping a connection alive. Your process can and will be killed at some point, if not by the system then explicitly by the user. I'm searching for a best way to do do this. What would you do? I would rethink what you're trying to accomplish and try to work within the restrictions imposed by mobile devices. Perhaps give the user a poll interval or an option for manually refreshing the data, if it makes sense for your app. - Services are bad design and a user might think his battery get drained - Activity with AsyncTask is beautiful if android not killing the app Hmmm (not sure there). One AsyncTask constantely listening for incoming and another AsyncTask gets created when user send jpg. Can an AsyncTask live that long, Is it possible to protect the AsyncTask from onCreate updates, orientationchanges? You can certainly keep your AsyncTask alive between orientation changes - but only as long as the user keeps your app in focus as the current Activity. Once you get put in the background you're subject to being killed. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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: Service or no service
I guess if you have a significantly large user base, but I'm assuming that's not the case, or is it? Im planing ahead, trying to learn what it takes to make and app like that Is some lagging or some delay in the delivery of these messages completely unacceptable? yes im playing with the ide since mail or sms is no instant What is so urgent about these messages that they *must* be received instantaneously? That is a powerful features for a mobile app Perhaps give the user a poll interval or an option for manually refreshing the data, if it makes sense for your app. no, that way the phone is never ready to receive . I would rethink what you're trying to accomplish and try to work within the restrictions imposed by mobile devices. your right ofcorce, im new to android but not to Java so the transition is a bit painful You can certainly keep your AsyncTask alive between orientation changes - but only as long as the user keeps your app in focus as the current Activity. Once you get put in the background you're subject to being killed. AsyncTask out the door, Services welcome in. There's really no such thing as keeping a connection alive. Your process can and will be killed at some point, if not by the system then explicitly by the user. In my Desire phone i see both fring and Google mssagin always running Read some about a service being Sticky I read elsewhere that a service can be started with a Brodcastcmmand http://stackoverflow.com/questions/4468006/can-i-start-a-service-without-activity-or-receiver cant wrap my head around the code implementation here. after reading many questions here and elsewhere about this. I think the method is: - an apk file which contains a Service an activity and a BroadcastReceiver Class. - action.BOOT_COMPLETED will start only my Service, not the Activity. The user can from Main Launcher start Activity for in app settings and I Bind to Service and Unbind when done Yea will try this tomorrow after work. I look at your TreKing app. Im impressed nice work That app would really been helpful this morning when i was waiting for the buss in the snowstorm. Can I ask how did you tap into CTA bus tracker system GPS signal for all there Busses location? -- 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: Service or no service
On Sat, Dec 18, 2010 at 4:54 PM, Hans-Erik erikswed...@gmail.com wrote: AsyncTask out the door, Services welcome in. Realize that a Service can just as easily be killed. There's really no such thing as keeping a connection alive. Your process can and will be killed at some point, if not by the system then explicitly by the user. In my Desire phone i see both fring and Google mssagin always running Read some about a service being Sticky AFAIK, sticky means the system will try to restart the Service if it was killed before it was done. This does not guarantee that you will always be running. I read elsewhere that a service can be started with a Brodcastcmmand http://stackoverflow.com/questions/4468006/can-i-start-a-service-without-activity-or-receiver cant wrap my head around the code implementation here. after reading many questions here and elsewhere about this. I think the method is: - an apk file which contains a Service an activity and a BroadcastReceiver Class. - action.BOOT_COMPLETED will start only my Service, not the Activity. The user can from Main Launcher start Activity for in app settings and I Bind to Service and Unbind when done Yes, you can start a service in response to system events, however, I stress again that your Service can and will be killed eventually. You cannot count on it living forever. I look at your TreKing app. Im impressed nice work Thanks :-) Can I ask how did you tap into CTA bus tracker system GPS signal for all there Busses location? They have a whole API for developershttp://www.transitchicago.com/developers/bustracker.aspx . - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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