Android :: Best Way To Logout Each Time Application / Task Goes To Background?
Jul 16, 2010
I have an application which requires a login at the beginning (this is the first activity). When the user logs in, I keep his credentials in the application (I extended android.application to add a field called 'key'). I would like to clear this field from memory (from application instance) an go back to the login activity.
I see the following possibilities: - Add a broadcast receiver to catch all possible event (call, click on menu, click on back, lock the phone ...) which clear the key field and launch the login activity - Use clearTaskOnLaunch for all activities except the login activity. But then until my application takes the focus again the key stays in the application object. (It seems it doesn't work with the go back button, maybe I need to use no history also) - Detect for each activity in all onPause or onStop events when application will leave the foreground to clear the key field and launch the login activity
The best would be to have a kind of OnPause method at application level but I think it doesn't exist.
View 9 Replies
Jan 30, 2010
I wish to have one application that runs in the background, which knows when any of the built-in applications (messaging, contacts, etc) is running. So my questions are: How I should run my application in the background. How my background application can know what the application currently running in the foreground is.
View 4 Replies
View Related
Jan 14, 2010
There seems to be a couple of ways to go about having a background task being executed. My usecase is to have my app fetch a datafeed every x minutes, regardless of my gui is running, and regardless of whether the phone is sleeping or not. I use an alarmmanager to schedule an intent matching a broadcastreceiver. in the onRecieve method i start a service (startService), which spawns an AsyncTask. The task fetches data and stores it and then stopSelf() the service.
in the onRecieve method i aquire a PARTIAL_WAKE_LOCK, before starting the service, and just before calling stopSelf() in the service, i release it again. Is this really the best way to do it? Do i even need the service in this scenario? I experience odd behaviour with this setup, where the setup works for hours and then suddenly stops, which makes it very hard to debug. Does anyone have a simple foolproof method to achive the same end?
View 1 Replies
View Related
Nov 9, 2010
I have a task which I need to run in the background in my Android app. It reads data over the network and populates a database. It can take several minutes to run.
Once it's started, it needs to complete successfully without interruption. (Otherwise I'll end up with a broken half-populated database.) I realise I can never guarantee it will always complete, but I want to make it as hard as possible for the system to kill off this task. For safety I guess I will have it populate a temporary database, and then only swap out the old database for the new one on successful completion of the import.
It's a modal operation; it does not make sense for the user to be interacting with the app while the import is in progress.
My first attempt is using an ASyncTask with a Progress dialog to achieve the modality, but this obviously breaks the "don't interrupt" requirement. I could work around the screen-rotation issue with ASyncTasks, but I don't think that goes far enough.
At the moment I'm not sure if this should be an ASyncTask, a Service, an IntentService, some combination of these, or something else entirely.
View 2 Replies
View Related
Aug 31, 2009
I'm trying to run a background task which runs every minute or so for an android application but I am struggling to ensure that the task actually runs every minute. I've tried a variety of approaches from using SystemClock.sleep() to the AlarmManager (both repeating alarm and a fixed alarm) but it seems that unless the device is charging any kind of repeating system has a variable repeat rate once the device is unplugged. Is there any way to run a stable consistently repeating service?
View 2 Replies
View Related
May 5, 2010
When I kill tasks in ATC and then hold the home button, it still shows apps running. What's up with that?
View 10 Replies
View Related
Aug 4, 2010
Say that the user has started my App and then switched off to use the Browser (so we have 2 sets of Tasks running). After a while, something happens to my app that requires the user's attention, so it posts a notification to notify the user. Is there a way to bring my App's task (and the Activity on top of the stack) out from the background when user clicks on my notification?
View 2 Replies
View Related
Jul 23, 2010
The official documentation describes tasks as follows: All the activities in a task move together as a unit. The entire task (the entire activity stack) can be brought to the foreground or sent to the background. Suppose, for instance, that the current task has four activities in its stack three under the current activity. The user presses the HOME key, goes to the application launcher, and selects a new application (actually, a new task). The current task goes into the background and the root activity for the new task is displayed. Then, after a short period, the user goes back to the home screen and again selects the previous application (the previous task). That task, with all four activities in the stack, comes forward. Is there a way to programmatically detect when the task of the current Activity moves into and out of the background? I would like to know when the user has switched switched to another application, vs. when the user navigated to another Activity in the current app.
View 2 Replies
View Related
Sep 29, 2010
I download some data from internet in background thread (I use AsyncTask) and display a progress dialog while downlaoding. Orientation changes, Activity is restarted and then my AsyncTask is completed.I want to dismiss the progess dialog and start a new Activity. But calling dismissDialog sometimes throws an exception (probably because the Activity was destroyed and new Activity hasn't been started yet).What is the best way to handle this kind of problem (updating UI from background thread that works even if user changes orientation)? Did someone from Google provide some "official solution"?
View 1 Replies
View Related
Apr 24, 2010
I've got an Android activity which grabs an RSS feed from a URL, and uses the SAX parser to stick each item from the XML into an array. This all works fine but, as expected, takes a bit of time, so I want to use AsyncActivity to do it in the background. The line items = parser.getItems() works fine - items being the arraylist containing each item from the XML. The problem I'm facing is that on starting the activity, the ProgressDialog which i create in onPreExecute() isn't displayed until after the doInBackground() method has finished. i.e. I get a black screen, a long pause, then a completely populated list with the items in. Why is this happening? Why isn't the UI drawing, the ProgressDialog showing, the parser getting the items and incrementally adding them to the list, then the ProgressDialog dismissing?
View 3 Replies
View Related
Jul 31, 2010
Is it possible to stop Astrid from syncing with RTM every time I check off a task as completed? I don't have a constant Internet connection and it keeps giving me a dialog window every time it can't sync.
View 9 Replies
View Related
Aug 25, 2009
at the moment I am thinking about a new app and need some information to decide whether to develop on Android or an alternative OS. I am particularly interested in "time to first screen", "boot-up time", "time to first Audio" and "app-start" (can be any from the android market or even one of the pre-installed ones) time? Does anyone know a source or perhaps measured those numbers?
View 9 Replies
View Related
Mar 27, 2010
I have an HTC eris and lately I've been having an issue with atm. Every time I have it kill my tasks it takes me to the HTC screen (the one that appears during start-up) and then "please wait" appears with my wallpaper in the background. It does still kill the tasks however it has never done this before and it seems abnormal. Ive heard that task managers can be bad for your phone?
View 10 Replies
View Related
Jun 22, 2009
I'm facing a connectivity problem in my IM-client for a long time already, but still can't find out how to fix it. Found a similar bug report here: http://code.google.com/p/android/issues/detail?id=2059 except PowerManager.SCREEN_DIM_WAKE_LOCK didn't work for me :(
So here is the problem: when device goes idle, wifi is being kept connected for some unpredictable time(1-20 min), but then established connection brakes and here is what i see on the ddms console:
CODE:...............
And "-1" is coming on read() from input stream or SocketException is raised. Then my app is trying to reconnect and sometimes it's successful almost immediately, but sometimes it takes more than 2-3 tries to reconnect(WifiMonitor logs reconnects again and again) with 10 seconds timeout.
Preventing some advices - yes, there is a PARTIAL_WAKE_LOCK and wifilock held by my app, but as i can see this is not enough.
View 2 Replies
View Related
Nov 6, 2010
I'm new here. Just got my phone 2day. Got on FB and can't figure out how to logout.
View 3 Replies
View Related
Mar 16, 2010
I am trying to create an AppWidget, in which the background color of a TextView changes at random at specified periodic interval.
The TextView is defined in layout xml file as code...
But i am getting a widget saying problem loading widget. If i remove the above line everything works fine.
LogCat says: code...
View 5 Replies
View Related
Aug 12, 2010
I just downloaded this Android System Information free from teh Market, and I thought I'd let you guys know about it. It's pretty damn awesome. It basically tells you everything you wanna know about your phone including every spec, every task running and how much CPU it is eaiting in real time, it has logs and everything. I highly recommend getting this app.
View 4 Replies
View Related
Mar 8, 2010
I need to find a way to programmatically logout from gmail account. I've noticed this happens when a new SIM card is inserted, but I need to do it from my app. Is this possible?
View 2 Replies
View Related
Nov 28, 2010
I have an alarm app (free). When I kill my application with task killer alarm doesn't work. Is this something about closing application abnormal way or what can I do because I think I can't say people don't kill my app with task killer.
View 6 Replies
View Related
Jul 6, 2010
Searched and read through all of the posts I could find about tasks, this one didn't seem to have been asked. I am a recent lifetime, primarily business, Blackberry convert (who's impressed by Android right down to my Swype keyboard). I have been on the search for a good task management app that integrates well with my messages (Live Exchange), and basically allows me to forward a message to my task list right from the message itself. Basically I want to open the email, determine it is a task that I need to get to later, and forward it to my task app. I know there is a rough way to do it with RTM by forwarding to my RTM inbox email address, and that's sort of okay, but RTM truncates the message severely, and I tend to lose all of the detail I need. I know Astrid is supposed to be great, but is there any way to better integrate with my device so that I don't have to manually enter all of the task details when they are already in the email message?
View 1 Replies
View Related
Oct 14, 2009
How can I prevent Sprint Navigation from running in the background all the time? Every time I go on the market, browser, check my email, or send a text, Sprint Navigation is shown running in all of my 3rd party app managers. I have task killer so I can kill it as I please, however I would like to completely prevent it from starting up when i'm not even using it. Any ideas on how I can accomplish this?
View 13 Replies
View Related
May 5, 2010
Under Settings>>Accounts & Sink backup assistant is an option. I set it up because I was curious to know what it was, however now that I know that all it does is back-up contacts and now that I know that I can't logout, I WANT IT GONE! How can I undo this?
View 8 Replies
View Related
Oct 14, 2009
Is it possible to log out of gmail so that the app requires you to log in?
I have the HTC Hero, there must be a way to log out of gmail right?
View 1 Replies
View Related
Jun 9, 2010
All activities in my application require a user to be logged-in to view. Users can log out from almost any activity. This is a requirement of the application. At any point if the user logs-out, I want to send the user to the Login Activity. At this point I want this activity to be at the bottom of the history stack so that pressing the "back" button returns the user to Android's home screen.
I've seen this question asked a few different places, all answered with similar answers (that I outline here), but I want to pose it here to collect feedback. I've tried opening the Login activity by setting its Intent flags to FLAG_ACTIVITY_CLEAR_TOP which seems to do as is outlined in the documentation, but does not achieve my goal of placing the Login activity at the bottom of the history stack, and preventing the user from navigating back to previously-seen logged-in activities. I also tried using android: launchMode ="singleTop" for the Login activity in the manifest, but this does not accomplish my goal either (and seems to have no effect anyway). I believe I need to either clear the history stack, or finish all previously- opened activities. One option is to have each activity's onCreate check logged-in status, and finish() if not logged-in. I do not like this option, as the back button will still be available for use, navigating back as activities close themselves. The next option is to maintain a LinkedList of references to all open activities that is statically accessible from everywhere (perhaps using weak references). On logout I will access this list and iterate over all previously-opened activities, invoking finish() on each one. I'll probably begin implementing this method soon.
I'd rather use some Intent flag trickery to accomplish this, however. I'd be beyond happy to find that I can fulfill my application's requirements without having to use either of the two methods that I've outlined above. Is there a way to accomplish this by using Intent or manifest settings, or is my second option, maintaining a LinkedList of opened activities the best option? Or is there another option that I'm completely overlooking?
View 2 Replies
View Related
Nov 15, 2010
I have a class which extends AsyncTask, which is intended to serve as a generic task manager class for my application. The strange behavior is that the progress dialog shows up, but is never dismissed. I am sure that onPostExecute() gets called for every task instance, as any Log.d("","") statements fire if placed in here, even the Toast messages show up from within this method, but I am not able to dismiss the static dialog. I understand that AsyncTask(s) have access to UI thread at only 2 places [onPreExecute() and onPostExecute()], so I think trying to dismiss the dialog in runOnUiThread() is unnecessary. All calls to executeTask() are made from different onCreate() methods of different activities that need to fetch some data over network before populating some of their UI elements, and I always pass the current activity's context to the tasks. As I do not switch activities until after the related tasks are completed, I believe the activity context objects are still valid (am I wrong to have assumed this???) I have never found any of them to be null while debugging.
Could this be a timing issue? I have also observed that most of the times DDMS shows all tasks get completed before the activity is displayed. If I use new Handler().postDelayed(runnable_which_calls_these_tasks,10); in the onCreate(), and add delaying code in foo_X(), the activities are displayed without any delay, but the dialog will just not dismiss(). I have read through quite a number of articles on this issue but am still not able to figure out exactly where am I going wrong. I do not want to define each task as private inner class Task1 extends AsyncTask<> in all of my activity classes and I would not want to (unless this is the only solution) load my application object with all activity references either as mentioned in this discussion: Is AsyncTask really massively flawed or am I just missing something?. I have spent a week on this and am absolutely clueless :( It would be great if someone can guide me, and let me know what am I missing. Following is the class definition: [I've removed some irrelevant application specific code for clarity]
public class NetworkTask extends AsyncTask<Void, Integer, Boolean> {
private Context UIcontext;
private int operationType;
private static ProgressDialog dialog;
private static int taskCount;
private NetworkTask(int operationType Context context){ this.UIcontext = context;
this.operationType = operationType;
if (taskCount++ == 0) dialog = ProgressDialog.show(context,"","Loading...");
}
public static Boolean executeTask(int operationType, Context context) { return new NetworkTask(operationType, context).execute().get();
} @Override protected void onPreExecute(){ super.onPreExecute();
if (taskCount == 1) dialog.show();
} @Override protected Boolean doInBackground(Void... arg0) { switch(operationType){ case TYPE_1: foo1();
break; case TYPE_2: foo2(); break;
case TYPE_3 foo3(); break; case TYPE_4: foo4(); break;
} @Override protected void onPostExecute(Boolean result) { super.onPostExecute(result);
taskCount--;
if (dialog.isShowing() && taskCount == 0){ dialog.dismiss();
}else { Toast.makeText(UIcontext, "Task#"+ operationType+", m done, but there are "+taskCount+" more", 5).show();
} } }
View 1 Replies
View Related
Jun 12, 2010
I am totally new to the android thing and the evo is my first ever droid based phone. I installed something called advanced task manager from the marketplace however I am finding several threads on how its not a good thing for the phone. I have no idea if its good or bad, but I do know that what shows up in the task manager list of running apps is way different than what shows up in the phones running task list - menu/settings/applications/running services. What shows up in task manager is a bunch of stuff that running services don't show. So whats the scoop? To have or not to have?
View 6 Replies
View Related
Oct 29, 2010
I've logged into my email account on my X10 MINI using my hotmail account it now shows pending emails that i have left to read but i cant seem to find the logout button any ideas on how i log out ? or does it just stay live ?
View 1 Replies
View Related
Jan 6, 2010
I want to develop an application in which if SIM card is changed then the application should sent SMS to a predefined number from the new SIM. User should not know that SMS are being send from his/ her mobile. For this application needs to run in background. How can I achieve it?
View 5 Replies
View Related
Sep 28, 2010
So we where testing the phone out and used my friends youtube account to test. Now i've created my own account but i can't remove my friends account from the Youtube app. How do i logout and switch to another youtube account?
View 14 Replies
View Related
Nov 20, 2010
I have logged in Gmail in my phone when I bought it. Since then it is logged in. It is like my gmail can be accessed by anyone who has my mobile and mails downloaded can be viewed/opened offline.But I do not know "how to logout from my gmail account".
View 12 Replies
View Related