Skip to content

Commit e11bc86

Browse files
committed
handle repeated starting attempts of Android service
1 parent 2674790 commit e11bc86

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/src/org/renpy/android/PythonService.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ public void onCreate() {
3636

3737
@Override
3838
public int onStartCommand(Intent intent, int flags, int startId) {
39+
if (pythonThread != null) {
40+
Log.v("python service", "service exists, do not start again");
41+
return START_NOT_STICKY;
42+
}
3943
Bundle extras = intent.getExtras();
4044
androidPrivate = extras.getString("androidPrivate");
4145
androidArgument = extras.getString("androidArgument") + "/service";
@@ -64,6 +68,7 @@ public int onStartCommand(Intent intent, int flags, int startId) {
6468
@Override
6569
public void onDestroy() {
6670
super.onDestroy();
71+
pythonThread = null;
6772
Process.killProcess(Process.myPid());
6873
}
6974

0 commit comments

Comments
 (0)