User Tools

Site Tools


import_a_script_directly_into_ll

**This is an old revision of the document!** ----

A PCRE internal error occured. This might be caused by a faulty plugin

**//This is only a preview. The Repository Importer is not yet available.//** In the Activity which wants to import a script add: <sxh java;> @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); if(intent.hasExtra("loadedScriptId")){ int id = (int)intent.getDoubleExtra("loadedScriptId",-1); //do something with id } // ... } } void loadScript(String code,String name,int flags){ Intent intent = new Intent("net.pierrox.lightning_launcher.script.IMPORT"); ResolveInfo info = getPackageManager().resolveService(intent,0); if(info == null) { new AlertDialog.Builder(this) .setTitle("Repository Importer missing") .setMessage("This action requires the Repository Importer to be installed. Do you wish to install it?") .setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }) .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.trianguloy.llscript.repository"))); } }) .show(); } else { intent.setClassName(info.serviceInfo.packageName,info.serviceInfo.name); intent.putExtra("code",code); intent.putExtra("name",name); intent.putExtra("flags",flags); intent.putExtra("receiver",getComponentName().flattenToString()); intent.putExtra("forceUpdate",true); startService(intent); } } void runScript(int id, String data){ Intent i = new Intent(Intent.ACTION_VIEW); i.setClassName("net.pierrox.lightning_launcher_extreme","net.pierrox.lightning_launcher.activities.Dashboard"); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.putExtra("a", 35); i.putExtra("d", id + "/" + data); startActivity(i); } </sxh> In your AndroidManifest.xml: <sxh XML;> <uses-permission android:name="net.pierrox.lightning_launcher.IMPORT_SCRIPTS"/> </sxh> Then you can simply call loadScript in your Activity with valid data to install the script and with the retrieved ID you can call runScript to run that script. This requires the Repository Importer to be installed on the device.

import_a_script_directly_into_ll.1422970583.txt.gz · Last modified: 2015/02/03 13:36 by lm13