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.
Related
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
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.
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.
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.
I need ur help..!
I m creating an app in android. The apps use the functions in the other apps which are already present. I want my app to be standalone. I can't use the functions in those app.
To be more clear, If i create an app for making video calls. The app needs to use the functions in the phone apps. can i just create an instance and use the functions or should i redo all the functions which are required?
It will be helpful if i get to know what will happen wen the app is inserted in the code base and compiled.? where ll the R.java file get created?
Could u suggest me some links to get a detail info about it?
developer.android.com is really useful when it comes to explaining the various features of android development, as well as some great code samples.
When you say you are using the functions of other apps, are you using intents or checking if the app is installed?
If there is an app that has the functionality you need, you can always set a home page that tells the user that these apps will be needed or change your application so it uses the features in android and not the third party apps.
Hope that helps!
If the apps don't provide an API or intent-filter for what you want to do, you cannot include/integrate them easily.
Unless you have a license to use components from the other apps and have access to their source code, you are going to have to re-implement the functionality you need from scratch or from a combination of available platform capabilities, libraries, and appropriately licensed example code.
(If you were content to leverage exported capabilities of other apps that had actually been installed on the device, you could do some things via intents. But you seemed to say this was not acceptable, that you needed to take capability from apps that would not be installed.)