@@ -74,7 +74,8 @@ protected void onCreate(Bundle savedInstanceState) {
74
74
//
75
75
// Otherwise, we use the public data, if we have it, or the
76
76
// private data if we do not.
77
- if (getIntent ().getAction ().equals ("org.renpy.LAUNCH" )) {
77
+ if (getIntent () != null && getIntent ().getAction () != null &&
78
+ getIntent ().getAction ().equals ("org.renpy.LAUNCH" )) {
78
79
mPath = new File (getIntent ().getData ().getSchemeSpecificPart ());
79
80
80
81
Project p = Project .scanDirectory (mPath );
@@ -316,5 +317,26 @@ protected void onDestroy() {
316
317
//Log.i(TAG, "on destroy (exit1)");
317
318
System .exit (0 );
318
319
}
320
+
321
+ public static void start_service (String serviceTitle , String serviceDescription ,
322
+ String pythonServiceArgument ) {
323
+ Intent serviceIntent = new Intent (PythonActivity .mActivity , PythonService .class );
324
+ String argument = PythonActivity .mActivity .getFilesDir ().getAbsolutePath ();
325
+ String filesDirectory = PythonActivity .mActivity .mPath .getAbsolutePath ();
326
+ serviceIntent .putExtra ("androidPrivate" , argument );
327
+ serviceIntent .putExtra ("androidArgument" , filesDirectory );
328
+ serviceIntent .putExtra ("pythonHome" , argument );
329
+ serviceIntent .putExtra ("pythonPath" , argument + ":" + filesDirectory + "/lib" );
330
+ serviceIntent .putExtra ("serviceTitle" , serviceTitle );
331
+ serviceIntent .putExtra ("serviceDescription" , serviceDescription );
332
+ serviceIntent .putExtra ("pythonServiceArgument" , pythonServiceArgument );
333
+ PythonActivity .mActivity .startService (serviceIntent );
334
+ }
335
+
336
+ public static void stop_service () {
337
+ Intent serviceIntent = new Intent (PythonActivity .mActivity , PythonService .class );
338
+ PythonActivity .mActivity .stopService (serviceIntent );
339
+ }
340
+
319
341
}
320
342
0 commit comments