When a user press the back button or home button, the activity is still alive. BUT in a few minutes or may be hours sometimes when they close the app and open it again the app starts from the first activity instead of resuming.
This problem is faced by lots of users. Some user have launcher installed in their phone and when they uninstall it the problem is solved. Users who don't have launcher installed also have the same problem. The app should work properly despite of the fact that external launcher is present or not. Also for testing I installed the launcher (Nova launcher) and my activity never closed. I don't know why.
Anyone have any idea about that?
Thanks!
Can you please check that by any chance you have set the Don't keep activities option to true, in Developers options.
Keeping that true will cause the similar kind of issue.
Related
So I have an app and I want it to run immediately whenever device got rebooted. To achieve this I added home category to MainActivity.
<category android:name="android.intent.category.HOME" />
After I reboot the device app will run directly. But when I first time click home button to go back to default home screen, nothing happens. Need to click home button again and device will act normally . Then from now on home button works fine until I reboot the device again.
I've checked the log and found out that on first time click home button nothing is triggered. And from second time click ActivityManager will start to work and call com.android.launcher3
Does anyone have any ideas why this weird situation happens?
Note:
When I checked the log I found out one line might be useful so I'll post it here. Not sure what is this mean though:I/PowerHAL: Don't support interaction_button in normal mode
I know there is another work around for RECEIVE_BOOT_COMPLETED. But then device will wait a few seconds on home screen to trigger broadcast receiver. Based on my requirement I can not use this solution. Thanks in advance if you suggest me this solution but please help for my current question.
At first, I'm new in programming of Android. And I have a problem/question.
Every Time i will click the 'Run' button to build and run my application on my device, my changes in the activity doesn't update/apply on device.
Is Anybody the, who know what i mean and know how to fix my problem.
I tried to find something in the preferences but i haven't found something.
At the moment i have to rebuild every time before run but this isn't a very nice way i think. There should be a better one.
Thank you for your answers.
Greetings
If you are using Instant Run, this is probably whats causing the problem - it doesnt recognise the changes you've made (at least that was the cause when I first had this problem). Just rebuild or clean your Project as already suggested - this will cause Instant Run to fully reinstall your application and not only install the new Patches. For me it occurrs quite often, I don't really see a pattern behind it but it's usually when I go to edit a completely different file/class, or when starting a new programming session.
Goto Build > Rebuild Project after that click Run again.
If it does not still updates your app I suggest to uninstall the app on the phone or in your emulator then Run again so a that a fresh APK copy will be installed.
Note: This is an odd thing when you are just running again without changing anything in your code.
The content should change, but I've noticed that with the latest instant run method, asset files typically don't get updated when you run it again. You could try setting up your preferences again and making sure you have updated your gradle, but if it's not updating you can simply kill the app before you run it again, either with the red stop button on Android Studio or though your phone.
I have just installed the latest version of SDK and ADT .when i open the logcat i found that the whole logcat was filled with the following message.still i am not start any project on eclipse!
PgaSocketWriteAllHdipc: hd_ipc_send() failed
hd_ipc_send: not connected
I just 10 minutes the number of this kind of messages reached more than 10,000 and i am fed up with this. Please tell me how can i remove this message from appearing in the logcat.
I was getting this error and discovered that it was a problem with Bluestacks. Bluestacks is an Android emulator for the PC that I had recently installed. Once I quit Bluestacks (which always runs in the background) the problem stopped.
Update:
If you really need bluestacks you can filter this messages by creating logcat filter or just go "System tray (which display in lower-right corner, in windows) then right click on blustack icon and click on "quit" then your problem will solve.
Check this link . Looks like its an official bug related to the emulator system image.
i have also same problem but i knew that it create by blustack , so please go "hidden icons" (which display in lower-right corner) then right click on blustack icon and click on "quit" then your problem will solve , try it...
if any problem then ask me...
Bluestacks needs to be closed(COMPLETELY) for this error to disappear. Just to add to bala's answer, it is important to end all bluestacks processes. For this, see the processes from all the users in the task manager(assuming you're on Windows) & kill each bluestack process.
Uninstall Bluestack. In my case, just stopping the program (quit option) was not enought.
The problem was definitely Bluestacks.. Though I do suggest you to close Eclipse if you're considering to uninstall! The LogCat does not adapt quickly to environment changes and you might get the message even after you uninstall.
I want to change my home in android device my requirements are like following
whenever I run my application my that time on pressing home key should be disabled
so that time on pressing home key should do nothing.
but if I close that application my home should be the previous one that is launcher
So it is possible on basis of running application my home get set
I use to change in manifest.xml file and disabling the package com.android.launcher but it won't satisfy me.
Long story short... no, you cannot do this.
There are some things you can do as workarounds that would themselves be hacky at best and basically not deliver the functionality you want. Like making your application be home replacement (launcher) itself then applying the desired functionality but even in that scenario it wouldn't do what you described you want done because you wouldn't really ever get back to the previous user defined home app (launcher) and there would be system dialogs the user would need to traverse to set your app as the home replacement (launcher).
Just so it is super clear though, you cannot override the functionality of the home button without the user confirming the action.
I have an android application which main view consists of a tab-bar with three tabs in it.
When developing and running the application on the device through adb I get the following behavior:
When clicking the phone button "Home screen" and relaunching the application it seems as the application continues where I was before pressing the button (remembers selected tab etc...) (apparently its still running in the background).
However when I export and sign the application (using Eclipse) it suddenly always seem to start a new instance of the application when returning from home screen.
Why does it behave so different in those cases? And what do I need to do in my application in order to always have the "running in background" behavior.
If you always want your application to have "running in background behavior", then set android:alwaysRetainTaskState="true" in your main activity manifest. This prevents Android from periodically resetting your application back to the root activity.
android:alwaysRetainTaskState
It sounds as though your application is being destroyed between the point that you go to the home screen and start the app back up again. This can be due to not having enough memory available on the device. If you have a lot of background apps running on your device this may be the reason it is happening.
I would recommend debugging and checking out which path is being hit, that is, whether or not your app is going through just the onResume lifecycle method, or if it is also going through the onCreate lifecycle method.