Skip to content

Commit

Permalink
add service
Browse files Browse the repository at this point in the history
  • Loading branch information
Ildar Mulyukov committed Jun 8, 2020
1 parent f1bf167 commit 008ca57
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name="Lua"
android:permission="android.permission.INTERNET"
>
</service>
</application>

</manifest>
20 changes: 20 additions & 0 deletions app/src/main/java/com/github/ildar/AndroidLuaSDK/Lua.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.github.ildar.AndroidLuaSDK;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

public class Lua extends Service {

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
//TODO do something useful
return Service.START_NOT_STICKY;
}

@Override
public IBinder onBind(Intent intent) {
//TODO for communication return IBinder implementation
return null;
}
}
4 changes: 4 additions & 0 deletions app/src/main/java/com/github/ildar/AndroidLuaSDK/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;

public class Main extends Activity {
Expand All @@ -10,6 +11,9 @@ public class Main extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_hello_world);
// use this to start and trigger a service
Intent i= new Intent(this, Lua.class);
startService(i);
}

}

0 comments on commit 008ca57

Please sign in to comment.