Skip to content

Commit 18a7b79

Browse files
authored
Merge pull request kivy#909 from inclement/fix_sdl2_services
Fixed app path for SDL2 services
2 parents e4cf131 + bf26fb4 commit 18a7b79

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

pythonforandroid/bootstraps/sdl2/build/jni/src/start.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ JNIEXPORT void JNICALL Java_org_kivy_android_PythonService_nativeStart(
302302

303303
setenv("ANDROID_PRIVATE", android_private, 1);
304304
setenv("ANDROID_ARGUMENT", android_argument, 1);
305+
setenv("ANDROID_APP_PATH", android_argument, 1);
305306
setenv("ANDROID_ENTRYPOINT", service_entrypoint, 1);
306307
setenv("PYTHONOPTIMIZE", "2", 1);
307308
setenv("PYTHON_NAME", python_name, 1);

pythonforandroid/bootstraps/sdl2/build/src/org/kivy/android/PythonService.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import android.app.Notification;
1010
import android.app.PendingIntent;
1111
import android.os.Process;
12+
import java.io.File;
1213

1314
import org.kivy.android.PythonUtil;
1415

@@ -110,7 +111,9 @@ public void onDestroy() {
110111

111112
@Override
112113
public void run(){
113-
PythonUtil.loadLibraries(getFilesDir());
114+
String app_root = getFilesDir().getAbsolutePath() + "/app";
115+
File app_root_file = new File(app_root);
116+
PythonUtil.loadLibraries(app_root_file);
114117
this.mService = this;
115118
nativeStart(
116119
androidPrivate, androidArgument,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ protected void doStartForeground(Bundle extras) {
3838

3939
static public void start(Context ctx, String pythonServiceArgument) {
4040
Intent intent = new Intent(ctx, Service{{ name|capitalize }}.class);
41-
String argument = ctx.getFilesDir().getAbsolutePath();
42-
intent.putExtra("androidPrivate", argument);
41+
String argument = ctx.getFilesDir().getAbsolutePath() + "/app";
42+
intent.putExtra("androidPrivate", ctx.getFilesDir().getAbsolutePath());
4343
intent.putExtra("androidArgument", argument);
4444
intent.putExtra("serviceEntrypoint", "{{ entrypoint }}");
4545
intent.putExtra("pythonName", "{{ name }}");

0 commit comments

Comments
 (0)