-1

我有奇怪的问题。我有一个启动线程的服务,在那个线程中有蓝牙连接。这工作正常(它仍在开发中,但它工作),我遇到了一个奇怪的问题:这是一个小 LogCat 转储,应该说明此时服务正在运行。

09-17 14:11:07.154: D/ReadXmlService(4552): The maximum numbers of event on the watch is reach (max: 5)
09-17 14:11:07.154: D/MetaWatchReminderApp(4552): size of lastUpdatedEventsFromXml: 0
09-17 14:11:07.154: D/MetaWatchReminderApp(4552): size of compareList: 4
09-17 14:11:07.154: D/MetaWatchReminderApp(4552): compareList.tostring: [dk.detech.metawatchreminder.EventsInfo@ca23e0ae,     dk.detech.metawatchreminder.EventsInfo@3bc334bf, dk.detech.metawatchreminder.EventsInfo@93e2b014, dk.detech.metawatchreminder.EventsInfo@895bc157]
09-17 14:11:07.154: D/MetaWatchReminderApp(4552): lastUpdatedEventsFromXml.toString: []
09-17 14:11:07.154: D/MetaWatchReminderApp(4552): The list have been updated return true
09-17 14:11:07.154: D/ReadXmlService(4552): new items in lastUpdatedEventsFromXml
09-17 14:11:15.071: D/CalenderService(4552): onCreate'd
09-17 14:11:25.091: D/ApacheBackground(4552): Background task
09-17 14:11:25.091: D/ApacheBtService(4552): onCreate'd
09-17 14:11:25.101: D/ApacheBtService(4552): state: connecting
09-17 14:11:25.111: D/MetaWatchReminderApp(4552): getBluetoothMac D0:37:61:C3:34:B5
09-17 14:11:25.151: D/BluetoothSocket(4552): create BluetoothSocket: type = 1, fd = -1, uuid = [00001101-0000-1000-8000-00805f9b34fb], port = -1
09-17 14:11:25.261: D/ApacheBtService(4552): before connect

该服务正在运行,然后调用该函数 OnCreate 方法,但它没有调用 OnStartCommand 函数,有没有人知道为什么会发生这种情况?

4

1 回答 1

0

查看您可能返回的标志onStartCommand(Intent, int, int)。如果 Android 重新启动您的服务调用,则onStartCommand(Intent, int, int)某些标志无法保证。

https://developer.android.com/reference/android/app/Service.html

于 2012-09-18T12:31:06.067 回答