I have an activity which is purely transparent (user can't see when it gets open).I open this activity from background service whenever I want to open it. After doing some work, I need to close that activity (not finish()
).I want to hide
or minimize
app. Actually, my app opens up for a second and do someWork
after doing someWork
, it continues to do remaining work (some uploading process) in background i.e. in onPause
.I don't want user to know that something opens & closed immediately.
Currently, I am using below code-
public void minimizeApp() {
Intent startMain = new Intent(Intent.ACTION_MAIN);
startMain.addCategory(Intent.CATEGORY_HOME);
startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(startMain);
}
Now, Problem is that If user is using some other app eg, playing game or using Whatsapp, When my app get opens over previous app(Game or Whatsapp) and minimizeApp()
is called then it minimises my app along with other app opened in background.
I want to minimize only my app.