Android :: MVC - Application Or Service For Asynchronous Updates
Jul 3, 2010
I have data that is to be refreshed from the Internet. Let's call it Model.
What I want to do: Basically it sounds like an MVC model, where the Model is also kept persistent in local (private) storage. The Model and its associated methods are application-wise. There are several Activity's that display and manipulate different aspects of it:
User
navigates across different Activity's
that display Model
from different perspectives. Currently I have a ListActivity for all elements, and an Activity for one element's details
Sometimes Model needs refreshing.
Surely this is done on a different thread. Refreshing can be triggered from several Activity's.
There are several (time consuming) common
tasks that can be triggered from different Activity's
My application loads and saves Model
to private storage when it starts
and stops
My problem: I'm not sure where to put Model and the related tasks in. Also, I don't know what mechanism to use to notify Activity's. Currently I come up with 2 approaches:
Use Service and send broadcasts. Saving to disk is performed in Service#onDestroyed(), so I want to minimize that by binding it to Activity's. At this point, I'm also not sure how to deliver the updated information: whether to provide a getter in Binder, or include that in the broadcast message.
Customize the Application object so that refreshing methods and getters are available globally. I then perform update from Activity's using AsyncTask. If there are other Activity's that are behind the current Activity, they will update in onResume() when the user navigates back.
Reasons I'm not using a class with static methods:
I need to save and store Model to disk. Some of the methods need a Context for displaying toasts, notifications, caching, etc.
Also, I don't put these functionalities in an Activity because there are several activities that manipulate the same piece of persistent data.
Below are pseudocode illustrating what I mean:
Using Service:
CODE:............
Make the functionality globally accessible in the custom Application object
CODE:...........
Weaknesses I can think of for the Service approach is complexity, since Binding is asynchronous. And it's very likely that I have to repeat some code because I have both ListActivity and Activity
For the Application approach, the documentation says not to rely on onTerminate() being called.
View 3 Replies
Apr 2, 2010
I've implemented a service that does an asynchronous sync between my application and google docs. I want to update the top level activity of my application when the sync is complete. However because of the service it's possible that the app could be be in a unknown state. Is there a way to make the top level activity, whatever that may be, recreate itself from an asynchtask in a service.
View 3 Replies
View Related
Jul 24, 2010
I am starting an activity from one by passing some data in the intent. I want the next activity to call some asynchronous service (rest service) with the data from intent and show the result on screen.
View 1 Replies
View Related
May 10, 2010
My initial doubts about the x10 were over its specs, such as no multitouch and an apparently slow sticky interface
Now they are more about Sony Ericsson and how well they will support the phone with software updates etc. Several bad indications:
- Complaints have been made in the past about SE sucking at this for other phones
- Phone was due out Jan 18. Arrived more than 2 months later
- Phone came out with an old o/s (1.6) while other phones came out with 2.1 at the same time.
- SE have said they wont provide an update until the end of the year!! incredibly slow. By then android 2.8 will be out. pathetic
I want to get a well supported phone that is going to improve and evolve.
View 13 Replies
View Related
Jan 26, 2009
I easily missed application updates I use. Is there any way to get update notification for each applications I installed? of should I check "My downloads" list occasionally?
View 4 Replies
View Related
Jun 24, 2010
I am curious about the procedure for updating an app that was acquired off the market. Do you simply install over your existing app? And if so, what happens to your existing data?Is there a way to tie your installed apps to the market, so it can automatically check for updates? Any information is appreciated.
View 2 Replies
View Related
Apr 13, 2010
Hi,
I'm planning to use my website to provide updates for my android application whenever the user decides to perform an update( in case there is one available) . I'm thinking to use http requests for the communication between the user and the server, so whenever there is a new update the server sents back to the user the link to download the apk of the update through the android browser. So far I think it should work !?!. But once I have the apk of the new update on the card ,and the installed old version of the application how do I actually perform the update ?
View 2 Replies
View Related
Apr 13, 2010
How an android application handles updates ? What kind of information does the application usually needs to send to request an update, and what does it receives back ?
View 1 Replies
View Related
Jun 22, 2010
I had thought that appbrain is more or less of a mirror of market. How come sometimes I got into appbrain and sync and it shows me no updates, but they I go into the market and it does show updates for some apps?
View 3 Replies
View Related
Nov 2, 2010
I'm having a problem when trying to stop location updates when the app goes into the background. In my onCreate() method I start request updates like this:
CODE:........
However the GPS icon remains in the status bar and the only way to get rid of it is to manually kill the application.
View 9 Replies
View Related
Mar 1, 2010
I'm pretty new to Android, and I had some questions that I've had trouble getting answered via the web. I have done a few searches, but I'm not sure how to word my question, either. So I apologize if this has already been covered somewhere...but here it goes. I was wanting to know how the Android handles application versions/ updates. Specifically, does an update blow away my database? Is there a way to preserve the users' settings as well?
View 5 Replies
View Related
Nov 8, 2009
In the process of creating an AppWidget which displays data from a remote host, I am looking for documentation about how to manage updates. Are there articles somewhere about how and when querrying remote data is the most appropriate? I am wondering if we have to explicitly code the remote queries in a separate thread, or even do it in a separate service, to avoid freezes of the home screen (this happens a lot on my htc magic).
View 3 Replies
View Related
Dec 2, 2009
I'm using a web service disguised as a ContentProvider and AsyncQueryHandler to isolate my activity from the delays of transport. My question is: during testing, how can I determine when my activity has retrieved the data from the web service? That would be after onQueryComplete() in the AsyncQueryHandler has come back with the "real" data. During manual testing, I just sit there and wait until the view updates. How can I do that using ActivityUnitTestCase and ActivityInstrumentationTestCase2?
View 2 Replies
View Related
Aug 19, 2010
providing updates to unpublished application( old users)
Lets say we have a PAID app - "x-some". 1000+ users downloaded and using it, before 28-Feb-2010. we stopped for some reason from 01-march-2010, by "unpublishing the app" from market.
however, we found some bug in x-some and want to fix it and also to be available to only 1000+ users who already downloaded it. We dont want this app to be seen by new users. Only old users( who downloaded this paid app), should be able to view it and download the new fix.
View 8 Replies
View Related
Sep 27, 2010
How can I kill Android activity from asynchronous thread? In my android application, I start another activity using startActivity. Is there anyway for me to kill that activity I started after several minutes?Or is there any way beside using thread?
View 2 Replies
View Related
Sep 9, 2010
I am using the following class to connect to my web service. I would like to make this asynchronous. How can I do this? code...
View 1 Replies
View Related
Sep 20, 2010
In iPhone there is Cocoa Asynchronous socket library. Is there a similar library in Java for Android? Can it be done using Java Asynchronous sockets(NIO library) or is there a way I can make use of NDK for Android and use native libraries for asynchronous sockets?
View 1 Replies
View Related
Apr 13, 2010
I want to create a communication layer in android. The layer will communicate with server asynchronously. Multiple activities should be able to call methods of the communication layer. The layer will get messages from the server (it is not important for the scope of this question how) and should be able to tell activities to do some work based on these messages.
How should I implement this? Should I do this using android Service?
The main questions that I need to answer are: How can activities access the layer? How can the layer access activities? How can i make the communication layer live for the lifetime of the application?
View 4 Replies
View Related
Sep 29, 2010
I seen to have a problem installing and updating pretty much all apps from the market. I am running anbranded and unrooted desire on 2.2. I have successfully downloaded nearly 50 apps from the market but recently it doesn't seem to install any apps including updates. I did find one that was ok (retro camera which I tried just to see) but it wont update sppedview, folder organizer lite or quick system info pro. It also doesn't seem to want to let me install quite a few other apps that I have tried (some alarm apps and some poker ones).
View 21 Replies
View Related
Oct 8, 2010
We wanted to follow-up. By now, you should have noticed that the installs metrics for your applications have been restored. We identified the problem as occurring with application updates only, have made some changes recently that should resolve and prevent this problem. Please let us know if this error persists.
If we can assist you further, please let us know. In my case, things have not changed at all. Downloads are increasing (1550) and active installs stabilized at 29% (the value before the drop was 44/45%). So, indeed active installs are increasing again - 29% is stable since three weeks - but the original percentage was not restored. Now, I don't know what to think... Maybe the problem is not solved, maybe in my specific case the active installs really dropped for a while (but it's curious that it only happened for a while...). BTW, I didn't release any new upgrade since then (I have a new one almost ready, but I'm beyond schedule because of personal problems) - and maybe the count would fix itself with new upgrades...
What would you do now? Is there anybody else for which the problem was not solved?
-- Fabrizio Giudici - Java Architect, Project Manager Tidalwave s.a.s. - "We make Java work. Everywhere." java.net/blog/fabriziogiudici - www.tidalwave.it/people Fabrizio.Giud...@tidalwave.it
View 6 Replies
View Related
Nov 24, 2010
Have to create thread and run it for 5 seconds, then I want to stop. How can I do that? I can't do anything with time/milliseconds.
View 3 Replies
View Related
Sep 26, 2010
There are a ton of activity stack related questions on StackOverflow, but I didn't really see any that answered the question I have. I'm working on an online game that (for now) has 3 different activities Login/Register Menu (seen when logged in, includes "new game", "my stats", and a few other things...I'm just worried about the "new game" option for now.
View 1 Replies
View Related
Oct 8, 2010
I am trying to make facebook asynchronous non blocking thread in android. due to which our UI is run separate thread but i am unable to do that can any one tell me how to do that.
and If possible please give me one example.
View 1 Replies
View Related
Oct 23, 2010
Just wondering if there's a way to uninstall application updates? Anything short of using something like Titanium Backup for all apps before letting them update? Basically, I have a widget that's been updated to support 'night mode' - now I can't see the details over my wallpaper Obviously re-installing the app from the Market will already contain the update .
View 3 Replies
View Related
Feb 13, 2010
I bought an app and had it for a while and got a notification for an update, but when i tried updating it takes me to the screen where you pay for the app. Did this ever happen to anyone else? I dont wanna pay another 4 dollars for an app i already bought. Btw the app is gameboid
View 4 Replies
View Related
Oct 10, 2010
Has anybody noticed download delays while trying to update an application? Sometimes it takes minutes or longer for a download to start so that an application can be updated...
View 4 Replies
View Related
May 15, 2013
I need to create a location update program which updates my location and send to the latest updated occasionally other named one's which has same application.
View 1 Replies
View Related
Jun 23, 2010
I'm new to Android. What happens when there are updates available to apps that I've installed from the market, and the pre-installed apps? Do I have to update it manually, and how? Or do they get updated automatically? I read that a new version of Google Maps is out, but I don't know how to update. My version does not display driving directions.
View 5 Replies
View Related
Feb 27, 2013
Since I reset my phone a few weeks ago, I get "Application updates available" notifications every day at 8:50am.
I cannot switch them off. I have disabled notifications in Google Play -> Settings -> Notifications, yet I still get them every day at the same time.
I am running Android 2.3.5 on a HTC Desire S, with HTC Sense Version 3.0
View 4 Replies
View Related
Nov 22, 2010
I've been trying to update a couple of applications that I have on my phone but everytime I try to download anything from marketplace, it just says "starting dowload..." and stays there. The application never actually downloads. I've dowloaded stuff in the past but I can't seem to download now. Is there something that I need to turn on
View 5 Replies
View Related