问题
We're developing an Android app for a POS system. Our app forwards the user to an app of a payment provider (Adyen) to handle the payment:
Intent intent = new Intent("com.adyen.posregister.payment");
// Here goes some irrelevant intent config
startActivityForResult(intent, 1);
However, the only thing the Adyen app does is firing up the payment terminal (over bluetooth). We would like to keep our own app visible all the time.
Question: is it possible to launch an external app (the Adyen app in this case) from our app, while keeping our app on the foreground?
Best regards, Willem
回答1:
The common methods to ask another app to perform a task for you without displaying any UI would be:
Starting a
Service
Sending a message to a
BroadcastReceiver
If the component you are using does not require UI it would make sense for it to support either or both methods, but whether or not it actually does is a question for the vendor.
In general there is no method to start another activity, forcing it to display no UI and return right away. Whether that happens is up to the other activity.
来源:https://stackoverflow.com/questions/26445022/android-app-launch-on-background