android-How to run Service in different thread than main thread?

前端 未结 5 1117
攒了一身酷
攒了一身酷 2021-02-18 14:29

I am trying to develop a application in android that consists a service to read the sensor value for multiple hours. When i start the service my device get hang and all the othe

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-18 14:52

    You can use Background Services to solve this problem. By using a Thread with sleep() for particular instance will give the solution to yours problem

    Background Servies

    This link Will help you..

    Or Using of PendingIntent will help you, like...

    PendingIntent operation = PendingIntent.getActivity(getBaseContext(), 0, ij, Intent.FLAG_ACTIVITY_NEW_TASK);
    

提交回复
热议问题