@@ -74,7 +74,8 @@ protected void onCreate(Bundle savedInstanceState) {
7474 //
7575 // Otherwise, we use the public data, if we have it, or the
7676 // 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" )) {
7879 mPath = new File (getIntent ().getData ().getSchemeSpecificPart ());
7980
8081 Project p = Project .scanDirectory (mPath );
@@ -316,5 +317,26 @@ protected void onDestroy() {
316317 //Log.i(TAG, "on destroy (exit1)");
317318 System .exit (0 );
318319 }
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+
319341}
320342
0 commit comments