Reputation: 25601
In web-based development and Windows-based development it is possible to develop applets or components that other applications can embed in their own UI seamlessly. I have a component (derived from View
) that does some real-time animation that I'd like other apps to be able to embed in their own views or activities. Is it possible to allow other apps to embed this component in them in such a way that, when my app is updated, the other apps will automatically exhibit the updated behavior in their embedded component?
If this is possible, I'm having a hard time figuring out the search terms to use to look up how to do this. How would one app go about embedding a view from another app, and what happens if that other app isn't installed?
Upvotes: 0
Views: 1549
Reputation: 11
You can create an app widget for your application, and that widget can be used by any application that acts as a widget host - which few do - but at least you could have it on your home screen. I wonder why this is not done more - that would be a killer feature for many applications.
https://developer.android.com/guide/topics/appwidgets/index.html
Gives more information.
Upvotes: 1
Reputation: 82553
You cannot directly allow embeding in the way of an iframe.
However, you could make your View a library project that other developers can include in their app, much like they include another company's SDK. To allow updating automatically, you will need to have your app installed in addition to theirs, and when making the library project, you will have to make a BroadcastReceiver that can react to broadcasts you send from your app to update the Views in other apps.
Your SDK can then receive these Broadcasts, and update your View accordingly.
Upvotes: 3
Reputation: 7533
You can make your current project as Library project. You add the Library project to the project you want use the custom View
. Your custom View
will be accessible in that project.
You can mark a project as Library project by going to Project Properties > Android and checking the appropriate checkbox.
Upvotes: 1