Android Question StartActivity don't work when used in an B4XPage app in background

mmanso

Active Member
Licensed User
Longtime User
Hi there,

I have a B4XPage that implments an HTTP api... After I run it, I start another app that uses that API to print to bluetooth for example.

There's a route on that API that calls an Android application using an Intent. And it works ok, when I'm on the B4XPage app. When it's not the main active Activity, it doesn't lauch the applicatuion. The HTTP work ok because I still can use it to print (event when the B4XPag app is not the main one) bit when it uses the StartActivity it doesn't do anything.

This is the code:

Dim in As Intent
in.Initialize("android.intent.action.VIEW", "vivapayclient://pay/v1" & _
"?appId=org.opalaconsult.printer.app" & _
"&action=sale" & _
"&clientTransactionId=" & UUID & _
"&amount=" & (amount * 100) & _
"&tipAmount=" & (tip * 100) & _
"&show_receipt=true" & _
"&show_rating=true" & _
"&paymentMethod=CardPresent" & _
"&callback=vivawallet_callback://vivawallet_result")

in.Flags = Bit.Or(0x10000000, 0x08000000) ' FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS

StartActivity(in)



Is there any way to make this work? I mean, use the StartActivity to open an app even when the app that does it isn't in th foreground?

Thanks in advance.
 
Top