Android exposing service to other applications - android

I need to expose a service in one android application. This service is to be used by other Android applications downloaded from play store in the device. How do I do it ?
Tried using AIDL, but it works only interprocess communication within the single application. Got error when importing the service.
It also worked when including application that contained the service as a library. But I want to do without making it a library.
Faced errors in importing when using methods mentioned here.. which works when they are in same application.
android communication between two applications
I also do not want to use content resolver.

Related

Android App to modify function of other applications

I am just getting back into Android programming after a while and I know that separate Android applications are allowed to communicate with each other in some capacity, but is it possible for one to build a proprietary application that can modify the features of an already existing application?
I don't mean applications like those 3rd Instagram applications (which were most likely built using their api ). I mean is it possible to create an application that would for example run in the background and possibly add features on already existing applications?
For example making an extension application for that runs in the background when you use the Twitter application that could potentially add features, or disable existing features?
(Sorry if this is not directly relevant I did not know where else to post this question)
In android apps are sandboxed.
It will be a major security issue if one app could influence the operation of other apps.
What can be done is letting apps interact with each other and exchange information, there are couple of ways to do this that relay on android Inter process communication, Android Binder Content providers and Intents.
What you can do is to draw on other apps. this will allow you to add some functionality without really changing anything in the background app
There are some apps that use this technique. LastPass is a good example.
See this article for more information

Whats an ideal way to share functionality between apps in Android?

I have moved from an iOS background to Android recently. My usecase is following.
I want to build a suite of apps. Each app needs to make server calls or do database operations. I do not want to write the code in each app of mine to do these operations.
So, I want to build a framework of my own which has API's exposed to do server and DB operations. Now, I can just import this framework in my applications and do server/DB operations.
In iOS this could be achieved by building a static library. How can similar thing be achieved in Android?
Initially I was thinking about services but If I am not wrong they are specific to only an application and can not be shared among different applications.
How can similar thing be achieved in Android?
Create and use a library module.
Initially I was thinking about services but If I am not wrong they are specific to only an application and can not be shared among different applications.
Services can be exported from one app and used by other apps.
A library is a compile-time construct. You are saying that you want one copy of the code on your development machine, but each app incorporates that code and uses it independently of other apps.
A service is a run-time construct. Here you are saying that you want one copy of the code running on a given device, and that other apps should talk to that one running copy of the code to perform various operations. This greatly increases the complexity of your apps and the coupling between them, and so using a service is not a simple substitute for using a library.
You're wrong about Services, I have a scenario where I communicate to same web server in each application.
So instead of writing same service in each application, I wrote one standalone service application which will expect my all application to Broadcast a message (depends on scenario). I exposed my database to service through ContentProvider. So my service know my application data. I achieved this successfully. Also you can use library module. You can know more from this link
Hope it give some idea.

Android/Webpage API architecture

If I have a website and an android application, it is correct to build a Rest API service to use it in both (web and app).
This way is more flexible to make changes one time right?
I'm using Hapijs and Catbox-Redis to handle the session store, also I am working on separated projects to deploy the API and Web projects on separated servers.
It is correct to use one API service for the Android Application and the Webpage?
It is absolutely appropriate. This is one of the big advantages of a services layer. It is very likely you will need some things that are specific to each, but most things will be common.
The really great thing will be when you have to write the THIRD interface that you don't know about yet (Google glass, apple TV, android watch, SOAP, who knows)

Hosting android app on a server

I'm a new to android so I don't know a lot of things you can do with a android application.
My main question is: Can you host an android application on a server then call it from another application when requested?
Can anyone recommend tutorial or an article about android application communicating with servers.
Or is there another way to store and use large databases that aren't stored in app itself?
An Android App can use any means available via TCP or UDP to communicate over the internet. HTTP is also built-in. Other/higher layer protocols (SOAP, ...) may need additional libraries to be added to your App, of which there are many readily available to choose from.
The point is: Almost any kind of client/server communcation can be implemented in an Android App; select one that fits your purpose and chances are that there is already a library available for it.
Running an actual Android App (.apk) on a server does not make any sense.

Google app engine - is it possible to create two web clients that will use the same datastore?

I created an application using Google app engine
I have two clients at the moment - one for android and another one for web application
and I want to add a mobile web application as well that will use the same datastore
I can't deploy the mobile web application because it will overwrite the web application that I already have
What do I need to do?
Thanks in advance
The Datastore is effectively partitioned by application. If you're operating on the same data, does anything prevent merging applications?
When you say two clients, do you mean two GAE apps?
The easiest (but probably not ideal) way to deal with it is to upload them as separate versions of the same app. GAE allows you to access different versions of the same app via different urls. You can then point your android app and the mobile web app at the appropriate urls.
Generally the better way to do it would be to design your mobile app and web app to use the same APIs.
This is a perfect use case for App Engine Modules, which provide multiple front ends (e.g. web apps, RESTful APIs, etc.) to the same underlying stateful services such as the datastore, memcache, and task queues. Each module can have its own set of versions, its own scaling configuration, and may be deployed independently of the others.
Java docs are here.
Python docs are here.

Categories

Resources