當前位置: 首頁>>代碼示例>>Java>>正文


Java PluginResult.setKeepCallback方法代碼示例

本文整理匯總了Java中org.apache.cordova.PluginResult.setKeepCallback方法的典型用法代碼示例。如果您正苦於以下問題:Java PluginResult.setKeepCallback方法的具體用法?Java PluginResult.setKeepCallback怎麽用?Java PluginResult.setKeepCallback使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.cordova.PluginResult的用法示例。


在下文中一共展示了PluginResult.setKeepCallback方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onActivityResult

import org.apache.cordova.PluginResult; //導入方法依賴的package包/類
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent)
{
    super.onActivityResult(requestCode, resultCode, intent);
    if (onActivityResultCallbackContext != null && intent != null)
    {
        intent.putExtra("requestCode", requestCode);
        intent.putExtra("resultCode", resultCode);
        PluginResult result = new PluginResult(PluginResult.Status.OK, getIntentJson(intent));
        result.setKeepCallback(true);
        onActivityResultCallbackContext.sendPluginResult(result);
    }
    else if (onActivityResultCallbackContext != null)
    {
        Intent canceledIntent = new Intent();
        canceledIntent.putExtra("requestCode", requestCode);
        canceledIntent.putExtra("resultCode", resultCode);
        PluginResult canceledResult = new PluginResult(PluginResult.Status.OK, getIntentJson(canceledIntent));
        canceledResult.setKeepCallback(true);
        onActivityResultCallbackContext.sendPluginResult(canceledResult);
    }

}
 
開發者ID:darryncampbell,項目名稱:darryncampbell-cordova-plugin-intent,代碼行數:24,代碼來源:IntentShim.java

示例2: execute

import org.apache.cordova.PluginResult; //導入方法依賴的package包/類
/**
 * Executes the request and returns PluginResult.
 *
 * @param action            The action to execute.
 * @param args              JSONArry of arguments for the plugin.
 * @param callbackContext   The callback id used when calling back into JavaScript.
 * @return                  True if the action was valid, false otherwise.
 */
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) {
    if (action.equals("getConnectionInfo")) {
        this.connectionCallbackContext = callbackContext;
        NetworkInfo info = sockMan.getActiveNetworkInfo();
        String connectionType = "";
        try {
            connectionType = this.getConnectionInfo(info).get("type").toString();
        } catch (JSONException e) {
            LOG.d(LOG_TAG, e.getLocalizedMessage());
        }

        PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, connectionType);
        pluginResult.setKeepCallback(true);
        callbackContext.sendPluginResult(pluginResult);
        return true;
    }
    return false;
}
 
開發者ID:disit,項目名稱:siiMobilityAppKit,代碼行數:27,代碼來源:NetworkManager.java

示例3: onEventsReceived

import org.apache.cordova.PluginResult; //導入方法依賴的package包/類
@Override
public void onEventsReceived(@NonNull Context context, @NonNull RadarEvent[] events, @NonNull RadarUser user) {
    if (RadarCordovaPlugin.eventsCallbackContext == null)
        return;

    try {
        JSONObject obj = new JSONObject();
        obj.put("events", RadarCordovaUtils.jsonArrayForEvents(events));
        obj.put("user", RadarCordovaUtils.jsonObjectForUser(user));

        PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, obj);
        pluginResult.setKeepCallback(true);
        RadarCordovaPlugin.eventsCallbackContext.sendPluginResult(pluginResult);
    } catch (JSONException e) {
        RadarCordovaPlugin.eventsCallbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
    }
}
 
開發者ID:Corollarium,項目名稱:cordova-plugin-radar,代碼行數:18,代碼來源:RadarCordovaPlugin.java

示例4: execute

import org.apache.cordova.PluginResult; //導入方法依賴的package包/類
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
    this.callbackContext = callbackContext;
    if (action.equals("getLocation")) {
        myLocation.getLocation(context);
        PluginResult r = new PluginResult(PluginResult.Status.NO_RESULT);
        r.setKeepCallback(true);
        callbackContext.sendPluginResult(r);
        return true;
    }
    return false;
}
 
開發者ID:starwander,項目名稱:cordova-plugin-amap-navi,代碼行數:13,代碼來源:AMapLoc.java

示例5: sendUpdate

import org.apache.cordova.PluginResult; //導入方法依賴的package包/類
/**
 * Create a new plugin result and send it back to JavaScript
 *
 * @param obj a JSONObject contain event payload information
 * @param status the status code to return to the JavaScript environment
 */    
private void sendUpdate(JSONObject obj, boolean keepCallback, PluginResult.Status status) {
    if (callbackContext != null) {
        PluginResult result = new PluginResult(status, obj);
        result.setKeepCallback(keepCallback);
        callbackContext.sendPluginResult(result);
        if (!keepCallback) {
            callbackContext = null;
        }
    }
}
 
開發者ID:dpa99c,項目名稱:cordova-plugin-inappbrowser-wkwebview,代碼行數:17,代碼來源:InAppBrowser.java

示例6: sendUpdate

import org.apache.cordova.PluginResult; //導入方法依賴的package包/類
/**
 * Create a new plugin result and send it back to JavaScript
 *
 * @param obj a JSONObject contain event payload information
 * @param status the status code to return to the JavaScript environment
 */
private void sendUpdate(JSONObject obj, boolean keepCallback, PluginResult.Status status) {
    if (callbackContext != null) {
        PluginResult result = new PluginResult(status, obj);
        result.setKeepCallback(keepCallback);
        callbackContext.sendPluginResult(result);
        if (!keepCallback) {
            callbackContext = null;
        }
    }
}
 
開發者ID:disit,項目名稱:siiMobilityAppKit,代碼行數:17,代碼來源:InAppBrowser.java

示例7: sendUpdate

import org.apache.cordova.PluginResult; //導入方法依賴的package包/類
/**
 * Create a new plugin result and send it back to JavaScript
 *
 * @param connection the network info to set as navigator.connection
 */
private void sendUpdate(String type) {
    if (connectionCallbackContext != null) {
        PluginResult result = new PluginResult(PluginResult.Status.OK, type);
        result.setKeepCallback(true);
        connectionCallbackContext.sendPluginResult(result);
    }
    webView.postMessage("networkconnection", type);
}
 
開發者ID:SUTFutureCoder,項目名稱:localcloud_fe,代碼行數:14,代碼來源:NetworkManager.java

示例8: onReceive

import org.apache.cordova.PluginResult; //導入方法依賴的package包/類
@Override
public void onReceive(Context context, Intent intent) {
    String action = intent.getAction();
    if (onBroadcastCallbackContext != null)
    {
        PluginResult result = new PluginResult(PluginResult.Status.OK, getIntentJson(intent));
        result.setKeepCallback(true);
        onBroadcastCallbackContext.sendPluginResult(result);
    }
}
 
開發者ID:darryncampbell,項目名稱:darryncampbell-cordova-plugin-intent,代碼行數:11,代碼來源:IntentShim.java

示例9: onServicesDiscovered

import org.apache.cordova.PluginResult; //導入方法依賴的package包/類
@Override
public void onServicesDiscovered(BluetoothGatt gatt, int status) {
    super.onServicesDiscovered(gatt, status);

    if (status == BluetoothGatt.GATT_SUCCESS) {
        PluginResult result = new PluginResult(PluginResult.Status.OK, this.asJSONObject(gatt));
        result.setKeepCallback(true);
        connectCallback.sendPluginResult(result);
    } else {
        LOG.e(TAG, "Service discovery failed. status = " + status);
        connectCallback.error(this.asJSONObject("Service discovery failed"));
        disconnect();
    }
}
 
開發者ID:disit,項目名稱:siiMobilityAppKit,代碼行數:15,代碼來源:Peripheral.java

示例10: sendMessageToDefaultCallback

import org.apache.cordova.PluginResult; //導入方法依賴的package包/類
/**
 * Send message to default plugin callback.
 * Default callback - is a callback that we receive on initialization (device ready).
 * Through it we are broadcasting different events.
 * <p/>
 * If callback is not set yet - message will be stored until it is initialized.
 *
 * @param message message to send to web side
 * @return true if message was sent; false - otherwise
 */
private boolean sendMessageToDefaultCallback(final PluginResult message) {
    if (jsDefaultCallback == null) {
        defaultCallbackStoredResults.add(message);
        return false;
    }

    message.setKeepCallback(true);
    jsDefaultCallback.sendPluginResult(message);

    return true;
}
 
開發者ID:SUTFutureCoder,項目名稱:localcloud_fe,代碼行數:22,代碼來源:HotCodePushPlugin.java

示例11: fetchUpdate

import org.apache.cordova.PluginResult; //導入方法依賴的package包/類
/**
 * Fetch new update from the server.
 * We will send request to the JS side, which will call appropriate JS module.
 */
private void fetchUpdate() {
    if (defaultCallback == null) {
        return;
    }
    updateRequested = false;

    PluginResult result = new PluginResult(PluginResult.Status.OK);
    result.setKeepCallback(true);
    defaultCallback.sendPluginResult(result);
}
 
開發者ID:SUTFutureCoder,項目名稱:localcloud_fe,代碼行數:15,代碼來源:HotCodePushLocalDevPlugin.java

示例12: sendCallback

import org.apache.cordova.PluginResult; //導入方法依賴的package包/類
private static void sendCallback(PluginResult.Status status, String message){
    if(!Thread.currentThread().isInterrupted()){
        final PluginResult result = new PluginResult(status, message);
        result.setKeepCallback(true);
        _callbackContext.sendPluginResult(result);
    }
}
 
開發者ID:SUTFutureCoder,項目名稱:localcloud_fe,代碼行數:8,代碼來源:CellLocationController.java

示例13: keepCallback

import org.apache.cordova.PluginResult; //導入方法依賴的package包/類
public void keepCallback(NaviLatLng point) {
    JSONObject json = new JSONObject();
    try {
        json.put("status", 1);
        json.put("lat", point.getLatitude());
        json.put("lng", point.getLongitude());
    } catch (JSONException ex) {
        Log.e("AMapNavigation.keepCallback", ex.getMessage());
    }
    PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, json);
    pluginResult.setKeepCallback(true);
    callbackContext.sendPluginResult(pluginResult);
}
 
開發者ID:starwander,項目名稱:cordova-plugin-amap-navi,代碼行數:14,代碼來源:AMapNavigation.java

示例14: onStreamGotten

import org.apache.cordova.PluginResult; //導入方法依賴的package包/類
public void onStreamGotten(String stream) {
  Log.d(TAG, "returning stream");

  JSONArray data = new JSONArray();
  data.put(stream);

  PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, data);
  pluginResult.setKeepCallback(true);
  streamCallbackContext.sendPluginResult(pluginResult);
}
 
開發者ID:MrShakes,項目名稱:cameraPreviewStream,代碼行數:11,代碼來源:CameraPreview.java

示例15: sendBluetoothStateChange

import org.apache.cordova.PluginResult; //導入方法依賴的package包/類
private void sendBluetoothStateChange(int state) {
    if (this.stateCallback != null) {
        PluginResult result = new PluginResult(PluginResult.Status.OK, this.bluetoothStates.get(state));
        result.setKeepCallback(true);
        this.stateCallback.sendPluginResult(result);
    }
}
 
開發者ID:disit,項目名稱:siiMobilityAppKit,代碼行數:8,代碼來源:BLECentralPlugin.java


注:本文中的org.apache.cordova.PluginResult.setKeepCallback方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。