private void btnQueueEvent() { EditText editText = (EditText) getView().findViewById(R.id.eventName); String eventName = editText.getText().toString(); if (eventName.length() > 0) { SwrveSDK.event(eventName); Snackbar.make(getView(), eventName + " queued", Snackbar.LENGTH_SHORT).show(); } }
private void btnAction() { RadioGroup radioGroup = (RadioGroup) getView().findViewById(R.id.radioGroupActions); int selectedId = radioGroup.getCheckedRadioButtonId(); View radioButton = radioGroup.findViewById(selectedId); int radioId = radioGroup.indexOfChild(radioButton); int action = ((RadioButton) radioGroup.getChildAt(radioId)).getId(); if (action == R.id.radioPurchaseEvent) { SwrveSDK.purchase("BANANA_PACK", "gold", 120, 99); Snackbar.make( getView(), "Purchase BANANA_PACK, gold, 120 cost, 99 quantity", Snackbar.LENGTH_SHORT) .show(); } else if (action == R.id.radioCurrencyGiven) { SwrveSDK.currencyGiven("gold", 99); Snackbar.make(getView(), "99 gold currency given", Snackbar.LENGTH_SHORT).show(); } else if (action == R.id.radioIap) { SwrveIAPRewards rewards = new SwrveIAPRewards("gold", 200); SwrveSDK.iap(1, "CURRENCY_PACK", 9.99, "USD", rewards); Snackbar.make(getView(), "In App Purchase", Snackbar.LENGTH_SHORT).show(); } else if (action == R.id.radioSendQueue) { SwrveSDK.sendQueuedEvents(); Snackbar.make(getView(), "Queued events sent", Snackbar.LENGTH_SHORT).show(); } }