How to access one App's Database to another Application using Sqlite? - android

I have two applications which resulting to use database.
Application A which creates database name DB1. This database I wanted to access in
application B. The applications are in different packages.
How can I do this ?

Application are not allowed to read private data of another application (you can do this only on rooted devices). The easiest way is to store database in some public location, but that is not recommend because any app on device will have access to database file...
Here is what you can do. You can create BroadcastReceiver-s from both sides and implement your communication protocol using message passing. Application B will broadcast requests, application A will handle that request and send result back to the application B. The only problem is that application A code must be updated to. For more info on how to use message passing, check this article

you need to have both applications installed using same user id. Add this to both manifests:
android:sharedUserId="com.abc.xyz"

Related

Sharing data between 2 Android applications

I have gone through a lot of similar answers, but since a lot of things have changed recently, I wanted to ask it again.
I have an application A that stores data in Shared Preferences. I want application B to be able to access the data stored in the Shared Preferences by application A.
Findings so far -
We can't use WORLD_READABLE for Shared Preferences, since it has
been deprecated.
We can't use sharedUserId to share data since it has been
deprecated.
I also read that apps signed with the same key can access each
other's code and data. But can we access the data just by doing that?
(Or do we need to do something else also along with the signing
process?). If yes, how?
One of the solutions is to share the data using Content Providers (data source being the Shared Preferences).
Are there any other ways to share the data as well?
I also read that apps signed with the same key can access each other's code and data
Only via sharedUserId.
Are there any other ways to share the data as well?
You could:
Have one app expose a service that the other app starts and passes the data via Intent extras
Have one app expose a service that the other app binds to and passes the data via AIDL parameters
Have one app send an explicit broadcast Intent to the other app with the data included in Intent extras
Have one app start an activity in the other app with the data included in Intent extras
Those options, as with the ContentProvider solution, can be secured by Android's permission system. If you carefully set up a custom permission, with a protectionLevel of signature, those apps will be able to communicate with each other, but other apps will not be able to hack into those communication channels.
And, of course, another option is to just have one app.

How to access other apps data for a backup application?

I'm very new to android developing, and I'm making a project in my university for an app that backs up every other application's data to cloud. So in order to do this, I have to access it. Is it possible? And is there a way to do this without rooting the device?
The app that you want to create as backup use content provider in that app for insert,add, create, delete the data.That app work like a database for you.
For second app fetch the data from the first app.
use this link.
http://developer.android.com/guide/topics/providers/content-provider-creating.html

Android Importing exporting sqlite data

So my idea is that i want to make it easy for people to convert over to my android app from someone else's. It seems as though i can import data into my database, correct me if i'm wrong, from a file. However, how can i (or another app available on the market) retreive the data from an app so that they (the user) can move it?
As far as I understand, you want to extract data from an app and use it with you app, isn't it?
That depends os how the app has the data stored, and almost all apps have the data stored in a way that you can't access it if you app don't have permissions to access it, and if that app don't offers a way of getting the data, you will need root permissions to access it, and for that the device must be rooted.
All that assuming that the data is on the device. Right now there are apps that save the data on internet, so you have to connect to the server the app connects and, using the same credentials to log in that the original app does, log and retrieve the data, and for retrieving the data you will need to use the same calls that the original app does. This is not good because at anytime the server calls needed to login or retrieve data can change and your app will be broken.
In other words, is impossible to access other app data in a normal way if that app don't have an API for your app to retrieve data.
Also if the app have an option to export data, then the user can export the data to a file in a common format so your app can open it.

In Android, How to monitor other app's sqlite database and update some rows

I want to implement an Android app which can monitor another specific app's sqlite database, and remove some specific rows from a table. The working senaria is as below:
Open a specific social app (for example, twitter), and press
Refresh/LoadMore
The social app sends HTTP request to retrieve
data
The social app parses the result, and insert into sqlite
database
[My App] My app monitors the table changes, and update
some rows
The social app displays records from sqlite to UI (The
rows that my app removes will not be displayed in UI).
Is it possible to develop such kind of app? I understand this app needs root access. But if the app has root access, can I achieve this goal? Thanks.
this is only done when other app have used ContentProvider and the give us Permission for access that.
A ContentProvider can be used internally in an application to access data. If the data should be shared with another application a ContentProvider allows this.
Many Android datasources, e.g. the contacts, are accessible via ContentProviders. Typically the implementing classes for a ContentProviders provide public constants for the URIs.
for more detail check this artical and this two artical from Adnroid Developer one and two

Is android SQ LITE file will be accessible to another user

I am a new bee in android platform and creating an application.I Need to save few data in to database and shared between two application.The data I am using for licensing, so my question is Is it possible to others to copy my data base from 'data/data/pack_name/database_name' and put it into a new device?. Any suggestion will be appreciated.
I don't think it is possible for application B to copy application A data without explicit permission of application B. We have content providers specifically for the purpose of sharing data between application. But you can always try this out by creating and application and trying to access it's data from another application.
If the device is rooted then I believe it is possible for another application to copy your data.

Categories

Resources