开发者

How do I build a wrapper (or launcher and receiver upon completion) for an external app in Android?

I'm working with a partner who has an app (App A) that wishes to call my app (App B). Once called App A will then wait for App B to finish what it's doing and collect some data.

In the exact scenario I'm working in, App A collects user info (name, phone) and then needs to pass it to App B. App B will do some stuff with that info and when finished, needs to notify App A that it succeeded (or didn't succeed) to perform ope开发者_如何学Pythonrations for user name_phone.

What do our apps need to know about each other for this to work?

I'm looking at startActivityForResult but I'm getting the impression that's something one would use within ones own application and not something App A can use to launch App B.

TIA


startActivityForResult() works fine between applications. You should take a look at Barcode Scanner by ZXing to see how they use startActivityForResult() for this very purpose.

App B will need to have an Activity with an <intent-filter> that will be stable, such as one using a custom action string. App B will also need to document what the Intent should look like (e.g., required action, required Uri if any, extras), and what will be returned via onActivityResult().

The author of App B could create a JAR file that provides a cleaner API for App A to use. ZXing did that with Barcode Scanner.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜