I need to call other App(pagseguro), send a value($$), and get the response of transaction...
return "Complete action using" and show me a list of apps!!!
but the app i want isn't on that list
https://postimg.org/image/90wpjfvwn/
The code in java
B4X:
Dim in As Intent
in.Initialize(in.ACTION_MAIN,"")
in.SetComponent("br.com.uol.ps")
'or ???
in.SetComponent("br.com.uol.ps.app")
in.PutExtra("FLAG_APP_PAYMENT_VALUE",10.00)
StartActivity(in)
return "Complete action using" and show me a list of apps!!!
but the app i want isn't on that list
https://postimg.org/image/90wpjfvwn/
The code in java
B4X:
private boolean checkIfAppIsInstalled() {
PackageManager pm = getPackageManager();
boolean installed = false;
try {
pm.getPackageInfo(PAG_SEGURO_PACKAGE_NAME,PackageManager.GET_ACTIVITIES);
installed = true;
} catch (PackageManager.NameNotFoundException e) {
installed = false;
}
return installed;
}
private static final String PAG_SEGURO_PACKAGE_NAME = "br.com.uol.ps";
private static final String PAG_SEGURO_CLASS_NAME = "br.com.uol.ps.app.MainActivity";
private static final String FLAG_APP_PAYMENT_VALUE = "FLAG_APP_PAYMENT_VALUE";
private static final int REQUEST_CODE = 123;
BigDecimal paymentValue = new BigDecimal(“10.99”);
Intent it = new Intent(Intent.ACTION_MAIN);
it.setClassName(PAG_SEGURO_PACKAGE_NAME, PAG_SEGURO_CLASS_NAME); // Intent que será chamada.
it.putExtra(FLAG_APP_PAYMENT_VALUE, paymentValue); // Valor da venda.
try {
startActivityForResult(it, REQUEST_CODE); // Chama o aplicativo do PagSeguro.
} catch (ActivityNotFoundException e) {
Toast.makeText(getApplicationContext(), "Aplicativo PagSeguro não instalado", Toast.LENGTH_SHORT).show();
}
private static final String FLAG_RESULT_ERROR_CODE = "FLAG_RESULT_ERROR_CODE";
private static final String FLAG_RESULT_ERROR_MESSAGE ="FLAG_RESULT_ERROR_MESSAGE";
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_CANCELED) {
//TODO: Apresentar mensagem de erro ao usuário informando que a operação foi cancelada
} else if (resultCode == RESULT_OK) {
if (data.hasExtra(FLAG_RESULT_ERROR_MESSAGE)) {
int errorCode = data.getIntExtra(FLAG_RESULT_ERROR_CODE, 0);
String errorMessage = data.getStringExtra(FLAG_RESULT_ERROR_MESSAGE);
} else {
String transactionCode = data.getStringExtra(FLAG_TRANSACTION_CODE);
String paymentMethod = data.getStringExtra(FLAG_PAYMENT_METHOD);
String cardBrand = data.getStringExtra(FLAG_CARD_BRAND);
String cardHolder = data.getStringExtra(FLAG_CARD_HOLDER);
BigDecimal paymentAmount = (BigDecimal)
data.getSerializableExtra(FLAG_PAYMENT_AMOUNT, 0);
int installmentNumber = data.getIntExtra(FLAG_INSTALLMENT_NUMBER,0);
BigDecimal installmentAmount = (BigDecimal)
data.getSerializableExtra(FLAG_PAYMENT_INSTALLMENT, 0);
Calendar time = (Calendar)
data.getSerializableExtra(FLAG_PAYMENT_TIME);
}
}
}