一站式学习Redis 从入门到高可用分布式实践MK

download:一站式学习Redis 从入门到高可用分布式实践MK import org.json.JSONArray;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import com.phonegap.api.PhonegapActivity;
import com.phonegap.api.Plugin;
import com.phonegap.api.PluginResult;
public class PluginTest extends Plugin {
public static String ACTION = "hello";

public PluginTest() { } /** * Executes the request and returns PluginResult. * * @param actionThe action to execute. * @param argsJSONArray of arguments for the plugin. * @param callbackIdThe callback id used when calling back into JavaScript. * @returnA PluginResult object with a status and message. */ @Override public PluginResult execute(String action, JSONArray args, String callbackId) { try { JSONObject jsonObj = new JSONObject(); //能够返回给JS的JSON数据 if (action.equals("hello")) { String str1= args.getString(0); //获取第一个参数 String str2= args.getString(1); //获取第二个参数 jsonObj.put("str1", str1+"1"); //把参数放到JSONObject对象中 jsonObj.put("str2", str2+"2"); //把参数放到JSONObject对象中 } PluginResult r = new PluginResult(PluginResult.Status.OK,jsonObj); return r; } catch (Exception e) { e.printStackTrace(); } }

}
复制代码
二、在plugins.xml中配置插件
在plugins.xml文件中添加对新插件的配置信息
复制代码


【一站式学习Redis 从入门到高可用分布式实践MK】 新增的插件类配置 name 写你的类名,value写 包名.类名-->


复制代码

    推荐阅读