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

Reply via email to