Skip to content

Instantly share code, notes, and snippets.

@v3ss0n
Created March 11, 2017 07:52
Show Gist options
  • Save v3ss0n/2f1228fbf1dd59d39e25f24cc657a0eb to your computer and use it in GitHub Desktop.
Save v3ss0n/2f1228fbf1dd59d39e25f24cc657a0eb to your computer and use it in GitHub Desktop.
package com.hexyn.hover;
import android.content.Context;
import android.content.Intent;
import android.webkit.WebView;
import android.widget.Toast;
import com.hover.sdk.main.HoverParameters;
import com.hover.sdk.onboarding.HoverIntegrationActivity;
import com.hover.sdk.operators.Permission;
import org.apache.cordova.*;
import org.json.JSONArray;
import org.json.JSONException;
import static android.app.Activity.RESULT_CANCELED;
/**
* Created by boggy on 3/10/17.
*/
public class BuyNow extends CordovaPlugin{
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
if(action.equals("sayHello"))
{
Context con=cordova.getActivity().getApplicationContext();
//Toast.makeText(cordova.getActivity(),"Success",Toast.LENGTH_LONG).show();
//Intent i = new HoverParameters.Builder(con).request("balance").from(13).buildIntent();
Intent integrationIntent = new Intent(cordova.getActivity(), HoverIntegrationActivity.class);
integrationIntent.putExtra(HoverIntegrationActivity.SERVICE_IDS, new int[] { 11 });
integrationIntent.putExtra(HoverIntegrationActivity.PERM_LEVEL, Permission.NORMAL);
cordova.getActivity().startActivityForResult(integrationIntent, 200);
try {
String responseText = "Hello world, " + args.getString(0);
callbackContext.success(responseText);
Intent i = new HoverParameters.Builder(con).request("send","100", "MMK", "09799112781").from(11).buildIntent();
cordova.getActivity().startActivityForResult(i, 0);
} catch (JSONException e){
callbackContext.error("Failed to parse parameters");
}
}
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment