資源簡介
本文件為cordova的一個插件,插件調(diào)用了一個Android的服務(wù)。服務(wù)是通過aidl方式調(diào)用的,并且服務(wù)被打包成一個jar文件
代碼片段和文件信息
package?com.haha.myEcho;
import?org.apache.cordova.CordovaPlugin;
import?org.apache.cordova.CallbackContext;
import?org.json.JSONArray;
import?org.json.JSONException;
import?org.json.JSONobject;
import?android.app.Activity;
import?android.content.ComponentName;
import?android.content.Context;
import?android.content.Intent;
import?android.content.ServiceConnection;
import?android.os.Bundle;
import?android.os.IBinder;
import?android.util.Log;
import?com.rayleigh.aidl.CloudServiceInterface;
import?com.rayleigh.cloud.CloudService;
/**
?*?This?class?echoes?a?string?called?from?javascript.
?*/
public?class?myEcho?extends?CordovaPlugin?{
????@Override
????public?boolean?execute(String?action?JSONArray?args?CallbackContext?callbackContext)?throws?JSONException?{
????????if?(action.equals(“myEchofunction“))?{
????????????String?message?=?args.getString(0);
????????????this.myEcholocal(message?callbackContext);
????????????return?true;
????????}?else?if?(action.equals(“service_on“))?{
?
評論
共有 條評論