Android - running a method periodically using postDelayed() call

前端 未结 8 1385
一向
一向 2020-11-27 13:45

I have a situation in an Android app where I want to start a network activity (sending out some data) which should run every second. I achieve this as follows:

In th

8条回答
  •  北海茫月
    2020-11-27 14:25

    You should set andrid:allowRetainTaskState="true" to Launch Activity in Manifest.xml. If this Activty is not Launch Activity. you should set android:launchMode="singleTask" at this activity

提交回复
热议问题