Android : StartActivity Intent Fails When Certain Apps Are Running
Jan 27, 2010
I am running into a critical conflict of sorts. My app is a remote service which essentially starts an activity when the screen goes to sleep. How it does this is very simple via screen off broadcast receiver and then an explicit intent to start the activity as a new task. The activity is basically in charge of responding to key events and displaying some simple text.
Thanks to a few window flags added in 2.0, activities can do this. They can be created in a way that either puts them on top of the lockscreen, or completely dismiss the lockscreen. This way they basically have focus without the lockscreen having to be dismissed by user. The alarm clock in 2.0 uses the flags to wake up the device and show the alarm dialog. I use them to place my activity when the screen sleeps so the user sees a custom wakeup lockscreen. The reason we create it at screen off is to get rid of lag the user experiences at wakeup involving first seeing the lockscreen, then seeing the activity appear. Also doing it immediately at sleep allows it to have focus so it can handle key events effectively.
The process works perfectly except in certain apps. So far, it seems the bug is consistent while browser (and even dolphin browser) as well as the facebook app are running. The bug never happens in GTalk or Launcher. It is rare but can still be duplicated in the messaging app every so often. I can't figure out why my activity doesn't get created at sleep while these apps are active. My remote service still gets the screen off broadcast and does the startActivity for the explicit intent, and that's all I get in the log. My onCreate is not being called. Instead it gets called when we wake the screen up again.
I have tried, as a control, to hold the partial wakelock starting when my remote service gets created, and the issue persists. So I don't believe it is a problem that the CPU has gone to sleep. Since only these particular apps cause the issue to duplicate, I can't imagine why the activity start fails. What could those apps be doing to interfere with another app's ability to get created? I use singleInstance as the launch mode so that I can ensure that the activity will never be able to be recalled by user process. I want it to go away when user unlocks and it is working fine like this, as long as it is able to be created. The singleInstance ensures I can have the same lockscreen handle an intent to do something specific based on user actions that the remote service monitors.
my source code can be viewed on my project page. http://code.google.com/p/mylockforandroid/source/browse/#svn/trunk/myLock/src/i4nc4mp/myLock
The issue happens to both my CustomLockService and NoLockService variations. These two services will start Lockscreen or ShowWhenLockedActivity and the bug is witnessed. The build illustrating the bug's end result-- user has to try to unlock 3 times due to the bug because on wakeup when the oncreate finally succeeds, user is seeing the activity when normally it would have auto-dismissed thanks to key event logic that also isn't seeming to happen due to the delayed onCreate, so they have to send it to sleep again. Now that the activity is properly done being started, and screen is asleep, the expected functionality happens at next wakeup-- can be downloaded also from the downloads tab.
This seems like an extremely irrational thing to be caused only by specific apps. I am quite baffled and out of ideas for a solution unless I've made some critical mistake in my activity definitions.
View 1 Replies
Aug 10, 2010
MyService and MyClient are both running, although MyClient is currently in the background. If MyService sends an Intent to MyClient via:
CODE:..............
How do I get this Intent in MyClient? Running this code triggers onResume() in MyClient, but because it's already running, calling getIntent() returns the Intent that initially created MyClient, which is always android.intent.action.MAIN
View 2 Replies
View Related
Sep 27, 2010
When ever we need to send an email in Android we will invoke registered email application using Intent.ACTION_SEND. like the below
Intent i = new Intent(Intent.ACTION_SEND);
startActivity(Intent.createChooser(i, "Send mail..."));
My doubt is why do we need to use Intent.createChooser in startActivity rather than using
startActivty(i).
Is there any specific reason of using Intent.createChooser()?
View 1 Replies
View Related
Jul 2, 2010
I've got an app that creates an intent for the last.fm android app in which it will start the "recommended" station for my account when i press a button. The trick i'm trying to figure out is how do i get the phone back to my app without the user having to navigate back manually? Once it start the last.fm intent it takes you to the playlist and i need it to resume back to my app automatically.
View 2 Replies
View Related
Sep 13, 2010
I am having two activities, say activity A and B. Activity A is an ListActivity, and when the items in the list is selected, it will call startActivity() to bring up B. The problem here is that when I am in B and click the home key, and then go to the application launcher to resume my application, A will be brought up again. This time when I click a different item in A, it will bring up B with the old data of the previously selected item before the home key was clicked.
After examinzing the code, I found that the startActivity does not update the intent of B. I found a post here about the similar question, and the answer was to overwrite the onNewIntent. However, I found that it doesn't work, because this method never get called when the second time I call startActivity. I am sure that this is the same instance, because I've printed out the instance number. Is there any other ways to update the intent of the activity? Or I need some other settings to make the onNewIntent get called? I didn't set any flags or launch modes, so everything is default.
View 1 Replies
View Related
Apr 11, 2010
I have a widget that supposed to call an Activity of the main app when the user clicks on widget body. My setup works for a single widget instance but for a second instance of the same widget the PendingIntent gets reused and as result the vital information that I'm sending as extra gets overwritten for the 1st instance. So I figured that I should pass widget ID as Intent data however as soon as I add Intent#setData I would see in the log that 2 separate Intents are appropriately fired but the Activity fails to pick it up so basically Activity will not come up and nothing happens (no error or warning ether)
View 1 Replies
View Related
Oct 17, 2010
My app works with pictures. It can take multiple pictures as an input, process them, and send them again to another app.
As a consequence, my main Activity has declared an intent filter on ACTION_SEND_MULTIPLE for image/* mimetypes and can result in issuing a new Intent with the same action and data type using Activity.startActivity(Intent).
Is there a way to exclude my own activity from the list of apps that is displayed to the user after the startActivity() call ?
View 1 Replies
View Related
Oct 15, 2009
I have an Activity X which is only accessible after you've entered a valid credential.
How can I prevent other apps from calling startActivity with an Intent pointing to X?
e.g. Intent intent = new Intent( this, ActivityX.class );
startActivity( intent );
Basically I don't want Activity X to be exported to any apps except my app.
View 1 Replies
View Related
Apr 6, 2010
Sorry for the newbie question, but does anyone know how I can check whether an IntentService is already running? I'm starting an IntentService from onCreate within a normal Activity, and that means that if the user minimises and maximises the application, it gets called twice. I'm wondering if I need to use something like the solution here http://bit.ly/du3VW5 or whether there's a simpler way.
View 3 Replies
View Related
Apr 20, 2009
I have an activity that uses a service. While the service is running (it sends some stuff in background) I display a progress bar and disable the send button.
Now I created an Intent to update the interface after the send service has finished. How can I do this only if the activity is still on top? I tried to figure out this in the service with:
CODE:..................
View 4 Replies
View Related
Mar 4, 2010
I put a notification in the status bar with a PendingIntent (with Extras info) that points to my main app (main activity). When the user clicks the staus bar, the PendingIntent is fired and my app launches and I can read the Extras info in my onCreate() method. So far so good.
But if my app is already running, the PendingIntent simply causes the app to come to the foreground and it does not call any of my methods, so I can't read the content in Extras. What can I do?
View 1 Replies
View Related
Aug 11, 2010
I'm develop a download manager function which the dialog will popup when the the item was finished download. the download function was running at background.
My question is how can I know when the downloading was finished and the project is intent other activity?
For example:
CODE:............
The above method where should I put? i try put it at onResume(), onStart() in every activity which will open by user. but unlucky it won't work.
View 1 Replies
View Related
Oct 19, 2009
I noticed that if i dont use the app to kill running apps after i exit them they are still running in the background is this normal for the Android? I am coming from Pre so not sure if they are killed when exited.
View 3 Replies
View Related
Jun 20, 2010
I want to disable the recent apps intent that is fired from the icon when you hold the home button. I am currently detecting, in the onCreate(), if the intent is fired from the quick launch dialog, and then I call finish(). This entails that when the application goes to the background finish() is called so that when the app is launched it goes through the onCreate(). This requires strategic coding when switching between activities in the application. I guess I can fire finish() in the onResume() also after detecting where the intent came from, but a bunch of unnecessary coding can be eliminated if the quick launch intent can simply be disabled.
View 1 Replies
View Related
May 7, 2010
I'm creating a mobile website that will include a page from which people can download relevant apps that we recommend. I've found instructions for creating the links to launch the Market but this assumes that you are the developer of the app in question and know the exact package name.
Is there any way to get the package name, other than just contacting the developers and asking?
Also, it turns out that those instructions don't really work for creating web hyperlinks. They only give you a URI to reference in a string of Java code in another Android app. Our site is in Drupal, so Java is not going to work.
For the iPhone, I found easy instructions for getting the URL/link style I need from the iTunes store, so I'm looking for info like that.
View 2 Replies
View Related
Jun 11, 2012
is there a way to limit the ics recent apps to running apps only?
View 2 Replies
View Related
Nov 15, 2010
My question is how to launch the third-party android applications I installed through Intent directly?
View 2 Replies
View Related
Jan 31, 2011
What launcher intent should be called, to bring up the "Recent Apps" list in the default home launcher? I am using a Pandigital Novel, and the lack of hardware keys make it very awkward to navigate the system. The softkeys in the OP status bar allow me to get to the home screen, and if I glitch it by making it timeout through countless presses occasionally brings up the "Recent Apps" screen which is great, but not reliable like that. (If they had the source code released, I could probably just fix the status bar keys to intentionally [pti] bring the screen up)
What I need, is the actual intent, so I can make a quick toggle app to bring it up. Or if you know of an app that already does this (Or widget, but I'd rather not as widgets mess with sleep on this thing, with the Google Experience/market hack).
I know that it can be done by emulating a home key press that's longer than the longpress timeout.
View 2 Replies
View Related
Jun 13, 2010
I have an EVO and I have a problem with it. I downloaded the app Advanced Task Killer to take care of apps running in the background. However sometimes when I pull it up I find that things like Sprint Navigation, Qik, Voice Dialer, and sometimes others are running without me pulling them up. My question is, how do I keep these apps from doing this, because they kill my battery when they come on and I don't know it?
View 7 Replies
View Related
Feb 22, 2010
I am new to Android, previous Crack Berry addict here. On the BB I could load Google Maps (including Latitude) to keep my position updated on Google Latitude online (I use it when I go riding on my motorcycle to give my wife a way to check if I'm still moving (= not dead)). Even if I shut down Maps, I could elect to have Latitude run in the background, so it would still update my position. How do I do this in Android? When I 'exit' Maps, it shuts it down, including Latitude, as far as I can tell. Can Android run Latitude in the background, or do I need to keep Maps open all the time?
View 8 Replies
View Related
May 16, 2009
Marcus Maximus from XDA-dev has released a new version of Apps to SD card that will format your drive and correctly create the necessary partitions required to run your apps from your SD card. You still need root for this, but it is so much easier (and faster) now.
App is available in market for .99 or on devs website for free.
Excellent Tutorial by the author here:
http://forum.xda-developers.com/showthread.php?t=512743
Anyone who asks "why root?", this is why, AppstoSD2 ftw.
You still need root for this!
View 12 Replies
View Related
Apr 7, 2009
My use case is to launch one of settings app screen when I receive a certain event in idle state. For which, I added my new intent to PhoneAppBroadcastReceiver() in PhoneApp.java (looks like this receiver handles the misc intents) But when i call startActivity(), The phone seems to go into a panic ex. startActivity(new Intent(this, NetworkSetting.class)); My questions are is this the right approach to go about ? If so 1. How can I launch the activity inside of broadcastReceiver? secondly 2. How do i verify if the activity i want to start is already started?Can the NEW_TASK_LAUNCH be used to verify this ,
View 2 Replies
View Related
Nov 23, 2009
I have splitted my Android project in 2 packages, lets say: test.current and test.another. From an activity in test.current I want to start an activity in the package test.another
View 6 Replies
View Related
Jul 15, 2010
Why should I use startActivity() in a Service? If I need an Activity a have to call an activity and if I need a "delayed activity" I have to use the notification. So, why should I use startActivity()?
View 1 Replies
View Related
Jul 22, 2010
I'm new in Android development and I've a problem when I create my new activity.I want to use my activity before start it. For example, But, my "menu" and "MyActivity.class" aren't the same instance.
View 2 Replies
View Related
Jun 29, 2009
According to the doc, if the intent in startActivity(intent) is not found, there will be an exception raised. Therefore I use a try/catch block. However, even if I use a random string as the intent, the promised exception does not occur.Instead I see a dialog that says: "No application can perform this function". I also get the same dialog if the intent is valid (picked up by an app) but apparently doesn't want to act when the extras are not what the app expects (e.g. my earlier question about Intent.ACTION_SEND and mime types). I am using the 1.5_r2 SDK on an AVD running 1.5, with the app running at version 1.1 (sdk=2). Is this a doc error, a bug or am I misunderstanding something? Can I simply delete the try/catch block?
View 3 Replies
View Related
May 15, 2009
I have a Activity and I have a class which extends this Activity. In this subclass I call:
startActivity(new Intent(this, CameraView.class))
Which should start the "CameraView" Activity. However, I always get this error:
CODE:...........
If it makes any difference the subclass creates a ListView and when a row of the ListView is clicked it calls startActivity();
View 5 Replies
View Related
Oct 11, 2010
We are trying to automate our QA process. We make wallpaper apps for Android. Once an app is installed, is there a way to figure out if the application is running since these have apps don't have a main class which we can check by doing a ps on android shell. I think keyboard/language apps would face a similar issue
For eg. If I install tetris and run it. Its main package will show up in shell ps. xyz.abc.Tetris. But the same is not true system apps in android.
View 1 Replies
View Related
Apr 9, 2010
Any other weekend athletes out there that train for triathlons and are using android apps?I'm new to the app world but am very interested in knowing if there are any running, cycling programs available to track routes, times and with the GPS even speed.
View 12 Replies
View Related
Jun 30, 2009
I can run an application in background but i want to know how many applications are running in the background.Like in some mobile while pressing the center button a list of currently running applications are displayed.Is this is possible in android.If possible means give some code snippets and steps to achieve this.
View 1 Replies
View Related