Created
March 11, 2017 07:52
-
-
Save v3ss0n/2f1228fbf1dd59d39e25f24cc657a0eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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