I am using Android tablet to test my application.
I press the home button to put the application to background.
Now, if
I launch the application from recent apps, it will open the same
screen, I was on, and will not restart the application.
But, if I launch the application from my apps, it starts a new
instance of application. This time it restarts the application
from splash screen, and when I check the recent apps, it shows
2 instances of my app.
I want only one instance of the application to be running, on my tablet, at any time. Please help...
Related
I have an android app with a single activity which is launched with SingleInstance mode. The app has a countdown timer. When the app is minimized and goes to the background and other apps are used, I want to bring my app to front when the countdown timer finishes.
I tried:
StartActivity(Intent.AddFlags(ActivityFlags.ReorderToFront));
But it does not bring my app to front. However, it may reactivate another app which is at the top of all minimized apps.
I have tried other ActivityFlags but they don't bring my app to front when it is minimized and another app is used. How can I bring the minimized app to front when other apps are used?
I have multiple activities in my app and a specific problem in which after my app is killed by the system, upon reopening the app (icon or from the overview) it starts loading my launcher activity with the splash screen instead of loading the last activity that the app was using.
My launcher activity is essentially a form of a login screen which should be used only the first time the app is opened, but instead it is reopened every time the app is killed by the system and app reopened by the user.
I am inexperienced and do not know if this is the default behavior of Android or a bug, I have searched through stack overflow but could not find a conclusive answer.
Coincidentally this well known long standing Android bug has appeared. (https://issuetracker.google.com/issues/36941942)
I do not know if the two problems might coincide, and I cannot be sure when the longstanding bug has first appeared because previously I was testing through Instant Run which does not result in the bug, but am now forced to test through play because it does result in the bug.
Thanks.
I am inexperienced and do not know if this is the default behavior of Android or a bug
This is the default behavior of Android, if there is no current task associated with your app. That includes:
User swiping the task off of the overview screen
You terminating the process and task from inside Android Studio
All the time if the user has been out of the app for 30+ minutes
User using Force Stop on your app in Settings
And probably some other scenarios that I'm not thinking of right now
My launcher activity is essentially a form of a login screen which should be used only the first time the app is opened
I recommend that your launcher <intent-filter> be on your primary activity in the app. If that activity determines that the user has not logged in, it can do something to authenticate the user (display a fragment, start an activity, etc.).
According to docs,getLaunchIntentForPackage("package name") is the great way to launch any app but I think it has some disadvantage is that it launches the app perfectly but it always create new instance of that launched app or it just start the main activity of the launched app even if the app is running in background with different activity.So my question is how to use getLaunchIntentForPackage("package name") to bring the particular app to front if it is already running on our system same as we launch the running app by long pressing home button in our android phone.Is there any solution...
I am developing one android application. In that i need to do below task. Can anyone suggest me how to do below task?
I want to force to user to stay on mine app, he/she can not open
another app. Only mine app is visible to top?
How can i achieve this?
Any help is appreciated .
I had a requirement where I need my App to run in foreground always, so that no other App should be running other than my App. Also, I had created a menu inside my App to Exit the Service that I created that keeps my App running always in foreground (not in this demo).
I had created a demo for the same in my github named as MyBackgroundServiceDemo.
Notes:
My requirement was for Tablet only.
I disabled back button of my App.
When user presses home button it will stay to home for 5 seconds (which is default by Android).
My Service keeps running constantly to keep track of Apps that are running.
I had modified the Service according to my requirement later on to keep track of my requirements. Same way you also modify the Service to meet your requirement.
I am building an Android application in Flex 4.5 and I am testing on a Samsung Galaxy S phone.
My application uses GPS and also Google maps.
When I run the application, and I try to close it, the application keeps on running in the background. I would like the application to stop when the user presses the device's home button or when the user clicks the back button until they leave the application.
How can I make the application shut down in both the cases?
This is how Android applications are supposed to work. See here: http://developer.android.com/guide/topics/fundamentals/processes-and-threads.html
Your application's process is in either the "background" state (if the user pressed how) or "empty" state (if the user pressed back).
For starters, you can try using the Activity noHistory flag in the manifest. This will make sure an Activity is finished if navigated away from.
http://developer.android.com/guide/topics/manifest/activity-element.html#nohist