Android - detecting application launch from home or history

前端 未结 4 1068
野趣味
野趣味 2020-11-29 10:18

What is the best way to detect when an Android \"Application\" has been launched from the Home screen/History screen?

Basically, what I\'m trying to achieve is force

4条回答
  •  無奈伤痛
    2020-11-29 10:54

    What about

        if((getIntent().getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY )!=0) {
            Log.d(TAG, "Called from history");
        }
    

    ? This uses a simple Intent flag.

提交回复
热议问题