Android PayPalPayment - Sometimes : Please make sure all fields have been entered - android

I try to implement in my app a payment via PayPal. The code is :
PayPalPayment payPalPayment = new PayPalPayment();
payPalPayment.setCurrencyType("EUR");
payPalPayment.setSubtotal(new BigDecimal("10"));
amountOfMoney = 10;
if (amountToReload_RG.getCheckedRadioButtonId() == euros20_RB.getId())
{
payPalPayment.setSubtotal(new BigDecimal("20"));
amountOfMoney = 20;
}
else if (amountToReload_RG.getCheckedRadioButtonId() == euros30_RB.getId())
{
payPalPayment.setSubtotal(new BigDecimal("30"));
amountOfMoney = 30;
}
payPalPayment.setRecipient("BLABLABLA#gmail.com");
payPalPayment.setMerchantName("BLABLALBA");
Intent paypalIntent = PayPal.getInstance().checkout(payPalPayment, this);
this.startActivityForResult(paypalIntent, 1);
I have tryied this on several smartphones. It works very well on two Samsung Galaxy mini (SDK 8 and 10) but does not work properly on a htc one s (SDK 16). I always get the error message : "Please make sure all fields have been entered".
Does someone have an idea that could help me ?
Many thanks for your help!

Related

Make call using a specified SIM in a Dual SIM Device

I have been searching for this from past few days and I came to know that:
"Dual SIM is not supported in Android out of the box. It is a custom modification by manufacturers, and there is no public API to control it."
There is a solution provided in the below link but its not working on my phone Samsung Galaxy S4 Mini.
Call from second sim
I also found this link, which I found very informative.
http://www.devlper.com/2010/06/using-android-telephonymanager/
Now I know that using the following code, I might have a chance to get lucky to make it working:
Intent callIntent = new Intent(Intent.ACTION_CALL)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
callIntent.setData(Uri.parse("tel:" + phone));
context.startActivity(callIntent);
callIntent.putExtra("com.android.phone.extra.slot", 0); //For sim 1
and
callIntent.putExtra("com.android.phone.extra.slot", 1); //For sim 2
I am not sure about this, but I have a question.
In Settings under the SIM Card Manager section, when I have to choose a preferred SIM card for Voice Call, I get four options:
Current Network
Ask Always
SIM 1
SIM 2
When I choose Ask Always option then before making a call I am always asked for choosing a SIM Card, displayed in a Dialog Box, to make the call. My question is can I exploit this thing in my App where I press a button to make a call but it always asks me the same way it does when I chose Ask Always option.
I am sorry, I made this question lengthy, but I think it required it. Please help and big thanks in advance.
EDIT:
How can I achieve this, everytime I press any button (Kind of similar to Ask Always option in Settings) :
Code:
private final static String simSlotName[] = {
"extra_asus_dial_use_dualsim",
"com.android.phone.extra.slot",
"slot",
"simslot",
"sim_slot",
"subscription",
"Subscription",
"phone",
"com.android.phone.DialingMode",
"simSlot",
"slot_id",
"simId",
"simnum",
"phone_type",
"slotId",
"slotIdx"
};
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + "any number"));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("com.android.phone.force.slot", true);
intent.putExtra("Cdma_Supp", true);
//Add all slots here, according to device.. (different device require different key so put all together)
for (String s : simSlotName)
intent.putExtra(s, 0); //0 or 1 according to sim.......
//works only for API >= 21
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
intent.putExtra("android.telecom.extra.PHONE_ACCOUNT_HANDLE", (Parcelable) " here You have to get phone account handle list by using telecom manger for both sims:- using this method getCallCapablePhoneAccounts()");
context.startActivity(intent);
TelecomManager telecomManager = (TelecomManager) this.getSystemService(Context.TELECOM_SERVICE);
List<PhoneAccountHandle> phoneAccountHandleList = telecomManager.getCallCapablePhoneAccounts();
Intent intent = new Intent(Intent.ACTION_CALL).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setData(Uri.parse("tel:" + number));
intent.putExtra("com.android.phone.force.slot", true);
intent.putExtra("Cdma_Supp", true);
if (simselected== 0) { //0 for sim1
for (String s : simSlotName)
intent.putExtra(s, 0); //0 or 1 according to sim.......
if (phoneAccountHandleList != null && phoneAccountHandleList.size() > 0)
intent.putExtra("android.telecom.extra.PHONE_ACCOUNT_HANDLE", phoneAccountHandleList.get(0));
} else { 1 for sim2
for (String s : simSlotName)
intent.putExtra(s, 1); //0 or 1 according to sim.......
if (phoneAccountHandleList != null && phoneAccountHandleList.size() > 1)
intent.putExtra("android.telecom.extra.PHONE_ACCOUNT_HANDLE", phoneAccountHandleList.get(1));
}
startActivity(intent);
I have an answer for this problem as I was looking for this option. Here are the steps:
first you need xposed framework and;
install miui application and;
add preferred sim option in contact

Set winner after turn based game Google API Android

I'm creating a turn based game on the Android platform using the API provided by Google.
At the end of the latest turn (in my case the third one), I'd like to set the winner but I have not found any API that permits this. Naturally I have all the data at the end of the game to set it.
I've not read something in the documentation - does this feature exist or should I handle it myself?
String playerId = Games.Players.getCurrentPlayerId(getApiClient());
String myOponentId = mMatch.getParticipantId(playerId);
opponentResult = new ParticipantResult(myOponentId,
ParticipantResult.MATCH_RESULT_WIN, 1);
creatorResult = new ParticipantResult(playerId,
ParticipantResult.MATCH_RESULT_LOSS, 2);
Games.TurnBasedMultiplayer.finishMatch(getApiClient(), mMatch.getMatchId(),mMatch.getData(), creatorResult,opponentResult )
.setResultCallback(new ResultCallback<TurnBasedMultiplayer.UpdateMatchResult>() {
#Override
public void onResult(TurnBasedMultiplayer.UpdateMatchResult result) {
processResult(result);
}
});

App works on PC but not in Android

I created an app using Unity3D. After developing it for some weeks I tried to generate an apk and test it on my SGII.
Unity returns no errors or warnings when testing the app locally, but when it runs on my phone, it doesn't work.
There are 2 buttons (1 to clock in and 1 to clock out from work). Button 1 takes the date when you clock in, and switches a boolean to allow you to clock out. When running in my phone, button 1 works fine but button 2 doesn't. The button works actually, since it returns every debug.log, but nothing else.
My code looks like this:
function OnGUI()
{
GUI.skin = skin;
if(Functions.firstTime == 0)
{
Functions.setupWiz();
}
switch(currentMenu)
{
case 1:
GUI.BeginGroup(Rect(0, 0, width, height));
if(Functions.birthday == true)
{
debugLog11 = "\n"+happyBirthdayMsg+", "+Functions.userName+"!";
Functions.birthday = false;
}
if(GUI.Button(Rect(buttonTopHMargin,height*.1f + buttonTopVMargin, width*.24f, height*.1f), "ENTRADA", "Box"))
{
if(!clockedIn && clockedOut)
{
var clockIn = Functions.clockIn();
debugLog11 = "\nHora de entrada";
debugLog12 = "\n"+clockIn[3]+":"+clockIn[4]+":"+clockIn[5];
clockedIn = true;
clockedOut = false;
}
else
{
debugLog11 = "\n"+errorMsg1;
debugLog12 = "\n";
}
}
if(GUI.Button(Rect(width - buttonTopHMargin - width*.24f, height*.1f + buttonTopVMargin, width*.24f, height*.1f), "SALIDA", "Box"))
{
if(!clockedOut && clockedIn)
{
// debugLog11 = clockedIn+"\n"+clockedOut;
Functions.clockOut();
var clockOut = Functions.clockOut();
var workedSecondsToday : Array = Functions.calculateDay();
var workedTimeToday = Functions.convertSeconds(parseInt(workedSecondsToday[0].ToString()));
var extraTimeToday = Functions.convertSeconds(parseInt(workedSecondsToday[1].ToString()));
var festTimeToday = Functions.convertSeconds(parseInt(workedSecondsToday[2].ToString()));
if(parseInt(workedSecondsToday[0].ToString()) > 0 && parseInt(workedSecondsToday[1].ToString()) < 1 && parseInt(workedSecondsToday[2].ToString()) < 1)
{
debugLog11 = "\nHora de Salida\nNormal:"; //NORMAL
debugLog12 = "\n"+clockOut[3]+":"+clockOut[4]+":"+clockOut[5]+"\n"+workedTimeToday[1]+":"+workedTimeToday[2]+workedTimeToday[3];
}
else if(parseInt(workedSecondsToday[0].ToString()) > 0 && parseInt(workedSecondsToday[1].ToString()) > 0 && parseInt(workedSecondsToday[2].ToString()) < 1)
{
debugLog11 = "\nHora de Salida\nNormal:\nExtra:"; //NORMAL + EXTRA
debugLog12 = "\n"+clockOut[3]+":"+clockOut[4]+":"+clockOut[5]+"\n"+workedTimeToday[1]+":"+workedTimeToday[2]+workedTimeToday[3]+"\n"+extraTimeToday[0]+"-"+extraTimeToday[1]+":"+extraTimeToday[2]+":"+extraTimeToday[3];;
}
else if(parseInt(workedSecondsToday[0].ToString()) > 0 && parseInt(workedSecondsToday[1].ToString()) < 1 && parseInt(workedSecondsToday[2].ToString()) > 0)
{
debugLog11 = "\nHora de Salida\nNormal:\nFestivo:"; //NORMAL + FESTIVO
debugLog12 = "\n"+clockOut[3]+":"+clockOut[4]+":"+clockOut[5]+"\n"+workedTimeToday[1]+":"+workedTimeToday[2]+workedTimeToday[3]+"\n"+festTimeToday[0]+"-"+festTimeToday[1]+":"+festTimeToday[2]+":"+festTimeToday[3];
}
else if(parseInt(workedSecondsToday[0].ToString()) > 0 && parseInt(workedSecondsToday[1].ToString()) > 0 && parseInt(workedSecondsToday[2].ToString()) > 0)
{
debugLog11 = "\nHora de Salida\nNormal:\nExtra:\nFestivo:"; //NORMAL + EXTRA + FESTIVO
debugLog12 = "\n"+clockOut[3]+":"+clockOut[4]+":"+clockOut[5]+"\n"+workedTimeToday[1]+":"+workedTimeToday[2]+workedTimeToday[3]+"\n"+extraTimeToday[0]+"-"+extraTimeToday[1]+":"+extraTimeToday[2]+":"+extraTimeToday[3]+"\n"+festTimeToday[0]+"-"+festTimeToday[1]+":"+festTimeToday[2]+":"+festTimeToday[3];
}
clockedOut = true;
clockedIn = false;
}
else
{
debugLog01 = mainMsg;
debugLog11 = "\n"+errorMsg2;
debugLog12 = "\n";
}
}
Can't explain myself better since I have no clue about what is happening. Any help will be much appreciated.
Yesterday, i started placing tons of labels everywhere in my code and finally discovered where it stopped.
It was just replacing this...
var sw = new StreamWriter(Application.persistentDataPath+"\\Settings.txt", false);
by...
var sw = new StreamWriter(Application.persistentDataPath+"/Settings.txt", false);
Only windows supports this bar "\" when used for setting paths, but i was thinking all the time that the error was somewhere in the OnGUI function.
Thanks lot to everyone who came helping me :)
On the Unity3D you can find this information:
Work with specific constraints (constraint):
Samsung Galaxy S (30 MB limit to downloadable file size, also problems with UI)
Samsung Galaxy Tab (30 MB limit to downloadable file size)
HTC Desire (40 MB limit to downloadable file size)
Samsung Galaxy S2 (Minor but possibly annoying issue: phone may work in 16-bit mode with Unity and show color banding Edit: a workaround was added to address the GS2 graphics driver, I don't know if it was related to this problem or not)
HTC EVO3D (Must build with Unity 3.4)
HTC Sensation (Must build with Unity 3.4)
Samsung Galaxy S2 (Minor but possibly annoying issue: phone may work in 16-bit mode with Unity and show color banding Edit: a workaround was added to address the GS2 graphics driver, I don't know if it was related to this problem or not)
Unity3D Android Limitations

keyup not working on Chrome on Android

I am using bootstrap typeahead.
It depends on this jQuery code to work:
el.on('keyup', doSomething() )
On Chrome on Windows it works fine. On Chrome on Android it doesn't. The keyup event is never fired. The element to which it is bound definitely has the focus.
This appears to be a recent development.
Chrome 28.0.1500.64
Android 4.1.2 SGP321 Build/10.1.1.A.1.307
Thanks
--Justin Wyllie
I came across this same problem earlier today. How can android chrome not support these key events! I assume you've found a workaround by now, but here's a fix that I came up with for now.
function newKeyUpDown(originalFunction, eventType) {
return function() {
if ("ontouchstart" in document.documentElement) { // if it's a touch device, or test here specifically for android chrome
var $element = $(this), $input = null;
if (/input/i.test($element.prop('tagName')))
$input = $element;
else if ($('input', $element).size() > 0)
$input = $($('input', $element).get(0));
if ($input) {
var currentVal = $input.val(), checkInterval = null;
$input.focus(function(e) {
clearInterval(checkInterval);
checkInterval = setInterval(function() {
if ($input.val() != currentVal) {
var event = jQuery.Event(eventType);
currentVal = $input.val();
event.which = event.keyCode = (currentVal && currentVal.length > 0) ? currentVal.charCodeAt(currentVal.length - 1) : '';
$input.trigger(event);
}
}, 30);
});
$input.blur(function() {
clearInterval(checkInterval);
});
}
}
return originalFunction.apply(this, arguments);
}
}
$.fn.keyup = newKeyUpDown($.fn.keyup, 'keyup');
$.fn.keydown = newKeyUpDown($.fn.keydown, 'keydown');
Sorry to say this but keyup/keydown events do not work for chrome browser in android.
There are other people who have reported this issue(Here and Here) from last 1 year and its not fixed yet. so it's better for developers to avoid using these events till it gets fixed.

Flex/Flash builder - app works in simulator or iOS but not android - HTTPService

Ok, I have an app I've been writing in Flash builder that makes several HTTPService requests to a server to gather some data about the user. In one view it goes and downloads a string from a server, it then splits the string using delimiter ":" and then adds the components to an array to populate a Spinnerlist. In the simulator this works great, if I package the app for iOS and install it on my iPhone - it works great. But when I try to run it to my Android device, it doesn't work. It acts as though it is working, it loads the view with the SpinnerList on it but the list is empty. I can't seem to figure it out.
Some things I've tried: the XML settings i have enabled the internet access to the android device, in fact, earlier in the app when the user logs in the phone make a very similar server call which works fine on all devices.
This issue has me completely dumbfounded, and help would be greatly appreciated!!
here is the code that makes the request and separates the data.
HttpService Request:
<mx:HTTPService id="CommonHTTP" url="http://dispatch.americantaxi.com:8080/AT/servlet/OnlineOrderServices?command=retrieveCustomerCommonPlaces&customerId={data.ID}" resultFormat="text"/>
Sorting code:
protected function button5_clickHandler(event:MouseEvent):void
{
PickUpType = "Common";
data.PickUpType = PickUpType;
var CommonDataString:String = new String(CommonHTTP.lastResult);
trace("String " + CommonDataString)
var Arr1:Array = [];
Arr1 = CommonDataString.split("|");
trace("arr1 length " + Arr1.length);
var ArrCount:Number = new Number(Arr1.length);
var Arr2:Array = [];
for (var i:Number = 0; i < (ArrCount - 1); i++) {
var currentSelect:String = new String(Arr1[i]);
Arr2 = currentSelect.split(":");
var currentName:String = new String(Arr2[1]);
trace("Add: " + currentName);
CommonPlacesArray.addItem(currentName);
}
data.CommonPlacesArray = CommonPlacesArray;
navigator.pushView(CommonPlaces, data);
}

Categories

Resources