Allow my Android view to be embedded in other apps - java

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?

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.

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.

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.

Related

Block some selected Menu-Points in Android for Parental Control

Is it possible to build a Android-App,
where a User can control or block some selected menu-points in the default Android Settings menu? For example Connections or Display.
Sorry, I am completley new in Android Development. I want to develop an app for Parental Control.
Thank you :-)
Iam learning Kotlin
No there's no way to do this. And remember- there isn't one settings app. Multiple OEMs write their own, or customize the base one. So even if you could do it in the AOSP version, there's no way to be sure that the others would work with it. If you need this for personal use, consider a custom ROM or replacing the settings app yourself. If this is for a store app, its just not going to work, look into device ownership and device profiles as the only real way to prevent (some) settings changes.

Self Updating app?

I'm new to Android development and I would like to ask if a self-updating feature could be possible. The details are:
The application is designed as an In House App, not going to be published on Google Play.
Will need to run only in Kiosk mode.
The self-updating feature will have to work as following: In the settings screen, there will be an Update button that will start downloading the new version of apk. After the apk will be downloaded, it will have to start the updating process automatically.
Is this even possible?
Yes, it's possible, furthermore, there are services that can do this for you, such as HockeyApp's update manager

Embed android application into other android application (Overlay + Events)

I was wondering if it's possible in android to embed an application into in another application. In this way you can have control of the embed application and you can add some other functionalities thanks to the parent application.
EDIT :
To be more accurate, I would like to have an application (parent application ) which can overlay the content of another application (embed application) without losing control of the parent application.
Thank you,
You can not specifically embed one app in another. And unless there is a specific inter-application API you have available to you, you cannot control the one app from your parent app either.
However if you just want to be able to view your parent app as some kind of overlay over another app, there are techniques that you might find useful.
It is possible to create an overlay view that can be seen when other apps are in the foreground. This is used by some chat clients, video playback, and task launchers. You can find some info on this method by looking at my answer here:
Background app to listen to Drag gestures
It is important to realise that in "the old days", a technique like this could be used to steal data from someone's phone. It was possible to receive taps & drags, and then pass them on to the other app.
This was a security hole, and has been fixed. So these days, you can choose if your overlay view should receive the taps or not i.e. if it is interactive, or just shows info.
Because of this, you will not want to cover up any of the "embedded" app with your own UI.
It is not possible any more to receive taps in your app, and pass them through to the other app.
This is not possible in general. The only thing that comes close is "embedding" an app widget in a home screen.

Is it possible to create an App Widget from within an App in Android?

Is it at all possible to create an App Widget programmatically from within an Android app itself? I'm rather lost on how to do this and Googling so far has led me to believe that it is not possible (that an App Widget and an App itself has to be separate applications).
So, would it be possible to dynamically create an App Widget from within an Android App? If not possible, how would you approach it? Thanks all!
Is it at all possible to create an App Widget programmatically from within an Android app itself?
That would depend completely upon what you mean by this.
I'm rather lost on how to do this and Googling so far has led me to believe that it is not possible (that an App Widget and an App itself has to be separate applications).
No, an app widget most certainly can go in the same Android project as the rest of the application. In fact, usually it does.
So, would it be possible to dynamically create an App Widget from within an Android App?
Again, you seem to think that the world knows what you mean by "dynamically", forcing us to guess.
An app widget, from the standpoint of code, consists of an AppWidgetProvider, an entry in the manifest pointing to that AppWidgetProvider, a metadata XML file, and whatever other resources you need (layouts, drawables, etc). All of that has to be written by a programmer and included in the app at compile time -- you cannot "dynamically" create those things.
An instance of an app widget is put on the home screen by the user, not by the programmer. Hence, a programmer cannot "dynamically" create instances of an app widget.
What the programmer can do "dynamically" is decide what is displayed inside of the app widget (e.g., current headlines for a news ticker, current song being played for a music player).

How do "add-ons" work for native apps?

I am designing an app for Android, iPhone/iPad and Windows Phone using GWT and PhoneGap. GWT will allow me to write the entire app in Java (my strong suit, unlike JavaScript or CSS) and will translate it into cross-browser JavaScript/AJAX. PhoneGap will then wrap that resultant JavaScript and turn it into a native app for each of the three platforms mentioned above.
I would like to have a "plugin-oriented architecture", whereby users can optionally purchase (or qualify for through other means) "add-ons" (plugins/extensions) that will enhance the functionality of the app.
Normally I would accomplish this by using the Java Simple Plugin Framework (JSPF) and allow users to download plugin JARs as they paid for them. These plugin JARs would then be added to the classpath of the main app so that the next time it starts and scans the classpath for plugins, it finds them and loads them.
Is this possible with native apps? I don't believe I can deploy anything other than APK, IPA and XAP (Android, iPhone and WinPhone respectively) files to these marketplaces.
In Java-land, this would be like having to download a "base" app in the form of an executable JAR (containing its own main method), and then having to download a "plugin" app that is also an exectuable JAR, and somehow get the two to behave like a normal plugin architecture (which would be if you have 1 exectuable JAR base app and then 1+ plugin non-executable JAR libs).
So I ask: how do add-ons work for native apps from a deployment/download perspective? How do you get 2 or more APKs/IPAs/XAPs to communicate with each other on the client-side? If not possible, how do native app developers handle add-ons (I know they exist, I've seen them!)? Thanks in advance!
as for iPhone - the only way is to implement the additional features and have them disabled until the user purchases in app to unlock the feature.
In Android you can have apps communicate with each other so that the user can just load add-on apps that provide only the add-on functionality. For more detail on this.. android communication between two applications
WP8 - I do not yet have experience
Although I am not a core Android Developer, here are some suggestions from my experience with Android till now:
One possible solution for Android is to use Updates for application. One way to achieve this is using a Background Service which checks for updates whenever app starts or use GCM (Google Cloud Messaging) to push update messages to the app. Second option is much better as you can provide instant update to the user ,on per device basis (a user can have multiple devices), as soon as he/she has bought your add on feature. After the user has got the update message you can download the whole app with new feature and update app on the device. Of course in this case you need to backup the existing data of the app and restore after installation of updated app.
I don't know if this thing can be done but it would be also be an good option in my opinion if you can provide a legitimate user, who have bought the particular add on, an updated app through Android Market.
Another way is to create each add on as a Service and then let the main app can detect (or bind) those services at startup and if they are available, your app can communicate with them easily. You can even call the UI portion of the newly deployed add on from your main app by using Intents and BroadcastReceivers.
You may also find this useful as far as Android is concerned:
However, there are ways for an application to share data with other
applications and for an application to access system services:
It's possible to arrange for two applications to share the same Linux
user ID, in which case they are able to access each other's files. To
conserve system resources, applications with the same user ID can also
arrange to run in the same Linux process and share the same VM (the
applications must also be signed with the same certificate).
Hope this gives some useful information to you.

Categories