radimkliment

radimkliment / Service

Last active 4 months ago

Like 0

Implementation of service, bounded service in Android

radimkliment revised this gist 6 months ago · 44dd3a6

1 file changed, 10 insertions

HelloService.kt (file created)
@@ -0,0 +1,10 @@
1 + class HelloService : Service() {
2 + override fun onBind(p0: Intent?): IBinder? {
3 + return null
4 + }
5 +
6 + override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
7 + return super.onStartCommand(intent, flags, startId)
8 + }
9 +
10 + }

radimkliment revised this gist 6 months ago · 30719eb

1 file changed, 5 insertions

AndroidManifest.xml (file created)
@@ -0,0 +1,5 @@
1 + <service android:name=".HelloService" />
2 +
3 + Intent(this, HelloService::class.java).also { intent ->
4 + startService(intent)
5 + }