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
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.
Did you declare the service in AndroidManifest.xml
?
Hi the code you write is working fine. May be you forgot to add the following code in the manifest file before closing application tag.
<application>
....
<service android:name=".MyServiceNotifications"/>
</application>
There are also circumstances where you need to put the "enabled" attribute to "true" when defining it in the manifest, like so:
<service android:enabled="true" android:name=".MyServiceNotifications" />
See this link for more info: http://developer.android.com/guide/topics/manifest/service-element.html
Very important: write the name space correctly, for example:
<service android:name="com.example.data.synchronization.SynchronizationService"/>
in my AndroidManifest.xml
previously it was (wrong):
<service android:name="com.example.data.SynchronizationService"/>
No service started and no error message!