Skip to content

Commit d08ca91

Browse files
committed
cleanup
1 parent fa0573e commit d08ca91

File tree

2 files changed

+9
-18
lines changed

2 files changed

+9
-18
lines changed

pythonforandroid/bootstraps/common/build/src/main/java/org/kivy/android/PythonService.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ public class PythonService extends Service implements Runnable {
2525
private Thread pythonThread = null;
2626

2727
// Python environment variables
28-
public String androidPrivate;
29-
public String androidArgument;
30-
public String pythonName;
31-
public String pythonHome;
32-
public String pythonPath;
33-
public String serviceEntrypoint;
28+
protected String androidPrivate;
29+
protected String androidArgument;
30+
protected String pythonName;
31+
protected String pythonHome;
32+
protected String pythonPath;
33+
protected String serviceEntrypoint;
3434
// Argument to pass to Python code,
35-
public String pythonServiceArgument;
35+
protected String pythonServiceArgument;
3636

3737

3838
public static PythonService mService = null;
@@ -65,6 +65,7 @@ public int onStartCommand(Intent intent, int flags, int startId) {
6565
Log.v("python service", "service exists, do not start again");
6666
return startType();
6767
}
68+
//when app is closed, OS will restart the service with null intent See #2401
6869
if (intent != null) {
6970

7071
Bundle extras = intent.getExtras();

pythonforandroid/bootstraps/common/build/templates/Service.tmpl.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import android.content.Intent;
44
import android.content.Context;
55
import org.kivy.android.PythonService;
6-
import org.kivy.android.PythonUtil;
76
import java.io.File;
87

98

@@ -41,10 +40,6 @@ public void run(){
4140
String package_root = getFilesDir().getAbsolutePath();
4241
String app_root = package_root + "/app";
4342
File app_root_file = new File(app_root);
44-
PythonUtil.loadLibraries(app_root_file,
45-
new File(getApplicationInfo().nativeLibraryDir));
46-
this.mService = this;
47-
4843
if (androidPrivate == null) {
4944
androidPrivate = package_root;
5045
}
@@ -66,12 +61,7 @@ public void run(){
6661
if (pythonServiceArgument == null) {
6762
pythonServiceArgument = app_root+":"+app_root+"/lib";
6863
}
69-
nativeStart(
70-
androidPrivate, androidArgument,
71-
serviceEntrypoint, pythonName,
72-
pythonHome, pythonPath,
73-
pythonServiceArgument);
74-
stopSelf();
64+
super.run();
7565
}
7666

7767
static public void stop(Context ctx) {

0 commit comments

Comments
 (0)