开发者

Ways of creating an Android "plugin"

开发者 https://www.devze.com 2023-03-06 09:20 出处:网络
I\'m just starting out learning Java and Android. Eventually I want to create an app that supports third party \"plugins\". Essentially, any developer could develop some code, perhaps in the form of a

I'm just starting out learning Java and Android. Eventually I want to create an app that supports third party "plugins". Essentially, any developer could develop some code, perhaps in the form of a library, that when installed gets integrated into my own app. This plugin could show up as a tab in my app with its own UI. The plugin would be able to communicate with my own app's built-in services or vice-versa. It can also communicate with other plugins. Note: what I don't want is the third party code to be a stand-alone app but rather开发者_Go百科 integrated into my own app. There are several reasons for this but one of them is that I cannot allow just any third-party code to be integrated. The developer's plugin needs to be approved first and can be prevented from being installed if it fails to meet strict guidelines (such as no porn).

Reading through Google's tutorials, I came across the following:

"The combination of startActivityForResult() and onActivityResult() can be thought of as an asynchronous RPC (remote procedure call) and forms the recommended way for an Activity to invoke another and share services."

Am I on the right track? That is, third-party developers would create a Java library and my code would somehow load it dynamically at run-time and the communications would be by Intents using either startActivityForResult or onActivityResult? Or is their some other way of doing this?


You might well be on the right track.

For examples of apps that use plug-ins and/or are plug-ins, you might like to take a look at OpenIntents projects and the ZXing Barcode Scanner app.

0

精彩评论

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