1

I am developing an e-commerce android application. Consider App B is my app. And in App B we have a wallet to pay for the things. Now the requirement is, there is some other app consider App A is trying to pay with App B using Deeplink.

Uri myAction = Uri.parse("myapp://open/myAction?name=" + name + "~" + Phone + "~" + Email);
 Intent mapIntent = new Intent(Intent.ACTION_VIEW, myAction);
 PackageManager packageManager = getPackageManager();
 List<ResolveInfo> activities = packageManager.queryIntentActivities (mapIntent, 0);
 boolean isIntentSafe = activities.size() > 0;
if (isIntentSafe) {
    startActivityForResult(mapIntent, 101);
            }

By this way, I am calling App B

after completing the payment in App B I moved to App A. How to achieve this one from App B

for clear info look at the image

enter image description here

Thanks in advance for the timing help.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
IamVariable
  • 408
  • 6
  • 23
  • Quesion is, are you developing the app which will handle the payment or the app which will consume payments app or both? – Mohammed Atif Aug 21 '18 at 04:33
  • Sorry for the confusion. My App has payment. Some other app trying to pay with my app using deep-link. after successful payment how can i redirect to their app. In the above image App B is my app – IamVariable Aug 21 '18 at 04:35
  • I Jus edited my question for clear understanding. Please look at this. Thanks @MohammedAtif – IamVariable Aug 21 '18 at 04:44
  • If you are using like `startActivityForResult(mapIntent, 101)` when calling the other app then expect that you are waiting for the result inside `onActivityResult(int requestCode, int resultCode, Intent data)`, check if the return `requestCode` is equal to the one that you've provided in calling the other app/intent then check also if the `resultCode` is `OK` or `Cancelled`. – Lester L. Aug 21 '18 at 04:59
  • Ok let me check on this. Thanks for the advice_/\_ – IamVariable Aug 21 '18 at 06:08
  • @MuthuS Please check this [link](https://stackoverflow.com/questions/14785806/android-how-to-make-an-activity-return-results-to-the-activity-which-calls-it), here is how you return the result from your activity after processing the payment. – Mohammed Atif Aug 21 '18 at 06:15
  • @MohammedAtif Yes, but in my case Open a app's payment screen from another app. So startActivityResult is workout? Sorry for the trouble. Thanks for your patience. – IamVariable Aug 21 '18 at 06:32
  • Yes it works. You can start activity for result from other app using deeplink. Please check PayTM or PayU APIs for reference. They will will be great help. – Mohammed Atif Aug 21 '18 at 06:43
  • Yes its working as expected. Thumbs up to you guys. Thank you so much for your support and advice. @MohammedAtif and and Lester L – IamVariable Aug 21 '18 at 07:11
  • let me create a separate projects and share github here. Thanks all – IamVariable Aug 21 '18 at 07:12

0 Answers0