简体   繁体   English

适用于Android的回调网址

[英]Callback url for Android intent

I'm working with a payment solution with another company, and in their API i have to send my callback url for when the transaction is complete. 我正在与另一家公司合作的支付解决方案,在他们的API中,我必须在交易完成时发送回调URL。 Are there any way to find the url to my application? 有什么方法可以找到我的应用程序的网址吗? My application is opening the payment application with an url, and after it's dont it should redirect to my application. 我的应用程序正在使用URL打开支付应用程序,而不是它应该重定向到我的应用程序。

Any ideas on how i can solve this? 关于如何解决这个问题的任何想法?

Some sample code bellow on how i open the payment application: 下面是一些有关如何打开付款应用程序的示例代码:

Intent vippsIntent = openVipps(getContext(), finalURL);
                    startActivity(vippsIntent);


public static Intent openVipps(Context context, String url){
    try{
        context.getPackageManager().getLaunchIntentForPackage("no.dnb.vipps");
        return new Intent(Intent.ACTION_VIEW, Uri.parse(url));

    }catch (Exception e){
        return new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    }
}

因此,您需要第二个应用程序完成时的结果,可以使用startActivityForResultonActivityResult ,第一个使用所有额外信息启动第二个应用程序(以及返回到应用程序的信息),第二个处理结果,更多有关信息,请参阅文档和此答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM