How android apps can communicate with each other? - android

I need a way to communicate and control from my app, every other app in a mobile android device.
Is there any communication protocol like SOAP (Web Services) for installed android apps?
I have found a way to open from my app, other apps but I can not control them to send and receive data.
Is there a way to do this?
Thank you

I need a way to communicate and control from my app, every other app in a mobile android device.
That is not generally possible. Few apps expose any sort of API that third-party apps can use to "communicate and control", outside of making a launcher activity available.
Is there any communication protocol like SOAP (Web Services) for installed android apps?
An app can choose to allow third-party apps:
start one of the app's activities, or
start or bind to one of the app's services, or
work with one of the app's ContentProviders, or
send broadcasts to the app
All of these (activities, services, providers, receivers) represent Android components. Those components that are exported can be invoked by third-party apps, through IPC, subject to any security conditions the app may put in place (e.g., third-party app must hold a certain permission).
Whether an app does any of this, and to what extent that it does, is up to the author of the app. This is no different than with Web services -- you, the client, cannot force a Web site to magically sprout a SOAP Web service. Similarly, you, the client, cannot force an app to magically sprout one of these IPC mechanisms.

Related

Passing data between applications in Android

Illustration:
How do I pass data coming from a form in my app to a third-party app?
Also, what are the terms, functions and APIs about doing this?
It is possible through Intent and URI.
The app that is receiving your data should support be open to receive URI so that you can fire up the Intent method it will open the app and send data.
You can refer: https://developer.android.com/training/basics/intents/sending.html#java
Unfortunately there is not a one-size-fits-all solution to this question, as such you are going to receive a variety of different "solutions" but the truthful answer is, it depends on the implementation of the app built by the other party;
Intents
If the third-party app is open to receiving data through intents, and hopefully the developer of that app has documented this somewhere. This would be the most streamlined approach.
It is important to note with this implementation that if there are specific apps you have in mind to connect to, and your application is going to be publicly available, then the user will need to have those specific third-party apps installed. This is easier if you only have one specific third-party app in mind (you can check the user's device to see if it is installed and inform them), and gets exponentially more cumbersome for every additional application you wish to connect to, not only due to having to instruct the user about yet another required third-party app but also as you will need to make sure you are able to pass all the necessary data to a completely different application.
Have a look at this earlier question to see how this can be achieved.
APIs
Another solution would be to use APIs. Just like intents, this requires the third-party developer to have exposed their application to these specific API calls, which you can then connect to to pass your data. The simplest real-world implementation of this approach would be signing on to an application using a social media account instead of having to create a separate account per application.
This is less streamlined than the intents approach as it would involve additional steps of posting your data to the API and then opening the other app in order to retrieve the data and proceed.

Using AIDL to create a service that manages multiple client data

I know this is not a straightforward solution question, but I do need expert opinions regarding this since I could not find the solution anywhere on the net.
We have a platform that exposes services via REST and we build applications on top of this platform (both HTML and Android). Now we help build android applications for different customers and the app base is growing with time.
What I have found is that for most of these apps, the tables used to store local data are the same and in many cases one android app is dependent on the other android app on the same device for data and in many cases the apps will be offline. For ex: App1 and App2 are installed, App1 gathers data which maybe required for App2 before the data is synced to the servers. So I have an idea of making this data common between apps regardless of which app is installed on the device.
The concept is to have a common service running in the background which provides an interface to other client apps either via content providers or AIDL. All the data of the apps installed on the device will be managed by this common service. Of course there will be differentiating factors like app id, context id, user id etc., to maintain the integrity of the individual app data.
Reasoning behind the architecture is,
1) Reduces redundancy of the tables involved.
2) Any app can query the data of any other app using the app id.
3) Sync can be offloaded to this common service and dependency on data can be easily managed.
4) updates to data management layer in the apps can be easily managed by updating a single application.
5) Improves the productivity of an app developer since he/she does not have to worry about managing data offline or syncing it to our servers.
Disadvantages that I could come up with are
1) Single point of failure for all the applications.
2) Data transfer between apps may be slow (Just a feeling).
What do you guys think about this approach? Please highlight advantages or disadvantages and if there are alternate approaches.
Apologies for the long post, let me know if I have violated any forum guidelines.

How to embed a mobile application in other application?

I'm building a mobile application for a company and I need to add in the company mobile application a button that go directly in a different application .
Anyone know a solution to embed 1 mobile app in other app???
Inside the code of your button, you can launch an explicit/implicit intent that can launch another application (authored by someone else). The application won't be running inside your application, but to the user, he/she will have the illusion that the other application running is part of your own. This is assuming of course that the second application is already installed on the user's phone. If it isn't installed, your button can just fetch the relevant application's installation page from Google Play for the user to install the app, and then run the application once installed.
In your application, you can also provide a content provider to keep your data. A content provider provider exposes a set of public CRUD interfaces to your data for other applications to access. This is how the contacts database is shared on Android for instance between many different applications, even non-Google applications.
Basically, you first need start at the beginning and educate yourself on the fundamentals of Android. If you start reading about intents and content providers, those constructs may not make any sense to you until you first learn about Activities, the Activity's lifecycle, stacks/tasks, and the way security generally works on Android. You may even want to look on Youtube, there are some very good highly rated Google I/O videos on there that talk about the fundamental concepts of Android.

MDM workflow in Android

Can any one help me out how to do MDM Integration in Android from client and server prespective?
I want to do an enterprise application which having lock and wipe functionality. I have no any clue of workflow of MDM in Android.
Thanks.
Android Device Admin API will do both things what you want to do (lock/wipe device and even more). An example is given and also you can find this complete source code in your Android SDK directory.
Now as client server perspective:
You have to implement your task (lock and wipe) in your android application (in client, i.e. known as agent). Now your application should be capable to communicate with your server or vice-verse.
I am 100% agree with adamk as he said "Remote controlling your application remains exclusively your responsibility - the Android framework does not provide (or enforce) any solution for that."
And Android gives your this feature too, as adamk said to use C2DM, he was right but now C2DM is deprecated, and GCM has been introduced, “a service that helps developers send data from servers to their Android applications on Android devices.” The service can send a message of up to 4 kb to an application on an Android device, most often to tell the application to retrieve a larger set of data. GCM will now handle all queueing and delivery for messages to Android applications.
You should read how to use GCM, and you can find sample code too. Download GCM Android Library from SDK Manager
and check android-sdk/extras/google/GCM directory
After establishing successful communication between your agent and server, evaluate msg in agent sent by server and perform desire action (lock/ wipe). This is again up to you how you define your message payload and how you handle those payloads in agent application.
Here is an article about Android MDM.
Happy Coding :)
You can use DeviceAdmin to gain privileges for managing the Lock preferences and performing device wipe (among other stuff).
(The user must add your app as a device administrator beforehand)
Remote controlling your application remains exclusively your responsibility - the Android framework does not provide (or enforce) any solution for that.
You may want to consider using Google's C2DM API, which is a convenient push mechanism.
As mentioned in the above answer, DeviceAdmin API can help. If you are using an Android device, you might know about the Android Device Manager (the web-based version) which allows you to manage your device. Basically, you can track, locate, lock, and wipe your device, some of the basic features of an MDM solution. So, in coding (though I am not a coding expert), you need to get access to the Device Manager (I guess, using some listener codes, or notification access).
Apart from this, MDM allows creating policies and groups of users (which would be a part of the coding in the app itself), then pushing the command over the internet (or OTA) to the connected device.
MDM also allows managing Apps and Data on the device, for which, you need the app to get access to the internal as well as external device storage.
Hope this helps. Good luck creating your MDM software

What is a "Web Application"?

Here, Google is talking about "web apps". Is a "web app" just an Android app that is connected to the web? Android app you need internet access for?
"Web app" is simply a broad term that can be used to refer to any web based/hosted site or service that involves a significant amount of user interaction, user generated content, or provides a "rich" user experience or a service API for third-parties to integrate with. A web app interface will "run" inside of a web browser, while typically all of the state handling and business logic will be handled by a backing server.
Google App Engine exists to provide a platform for implementing the "backing server" component of a web app (as well as basic hosting for the static resources needed by the app).
The concept of a web app really has nothing to do directly with Android apps. However, an Android app may (and many Android apps commonly do) communicate with a web app to provide various features or services within the app (think weather, Facebook integration, etc.). And in certain cases it is possible to implement a "quick and dirty" Android app by simply pointing a WebView at an existing web app's URL. In such a case that Android app's WebView becomes the "browser" that the web app's UI runs in.
Web app traditionally means a browser-based UI.
Google Web Apps was introduced in 2008, before the rise of the iPhone and Android. I would say those are a later addition to the definition.
If the client is using HTTP as its communication protocol with back-end services, I would call it a "web app", regardless of what the client hardware is.

Categories

Resources