Why is this simple service not starting?

前端 未结 5 1271
伪装坚强ぢ
伪装坚强ぢ 2020-12-15 02:13

I have a service with a handler that has to write \"Hello\" in the logcat every 5 seconds. But it doesn\'t write nothing on the logcat... It\'s like the service is not execu

5条回答
  •  猫巷女王i
    2020-12-15 02:46

    If using Xamarin Droid the easiest way to do this is to mark the class as a service like this:

    [Service]
    public class LongRunningTaskService : Service
    {
        ...
    }
    

    Then there's no need to put it in the AndroidManifest.xml.

提交回复
热议问题