Copy database data from one app to another

ValDog

Active Member
Licensed User
Longtime User
My app needs to call another app on the android to extract data from my database. I know this entails use of ContentProvider and ContendResolver functionality - which I don't know how to address. Would appreciate feedback from anyone who has dealt with this before.
 

darknuno

New Member
Licensed User
Longtime User
suggestion

Hi, I already asked myself a way to do that and thought this way:
You could update your database (sqlite) and copy it to a common location when your app ends. The 2nd app would copy it from common location to local in order to work it and save it again to common location when work is done....

That is my thinking....
Hope it helps.
 
Upvote 0

ValDog

Active Member
Licensed User
Longtime User
Contrary to the response by "darknuno" the second application I was discussing is a third-party application. Does this affect your response?
 
Upvote 0

ValDog

Active Member
Licensed User
Longtime User
Discussing this interface with the other 3rd-party app developer, it appears that for them to read data I've collected in my database table I just have to include a Content Provider in my application code. How do I go about doing that with b4a?
 
Upvote 0

ValDog

Active Member
Licensed User
Longtime User
Not sure how to go about writing a library; here's the relevant interface code I was given (in Java):

Content Provider - my app:
----------------------------
import android.content.ContentProvider

public class StatusProvider extends ContentProvider
{
public static final Uri CONTENT_URI = Uri
.parse("content://com.YourApplication.WhatTableToQuery");

public Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder)
{
long id = this.getId(uri);
SQLiteDatabase db = statusData.dbHelper.getReadableDatabase();
return db.query(StatusData.TABLE, projection, selection, selectionArgs,
null, null, sortOrder):
}
}


Content Resolver - their app:
----------------------------
public class StatusResolver
{
Uri.parse("content://com.YourApplication.WhatTableToQuery");
Cursor c = getContentResolver().query(uri, null, null, null, null);
}


Also need to add the following to manifest to allow other application access:
------------------------------------------------------------------------
<application>
<provider android:name=".StatusProvider"
android:authorities="content://com.YourApplication.WhatTableToQuery" />
</application>


How would I go about implementing this under b4a?
 
Upvote 0

ValDog

Active Member
Licensed User
Longtime User
Still looking for some feedback on how to implement the Content Provider code. Can anyone help me?
 
Upvote 0

ValDog

Active Member
Licensed User
Longtime User
I'm still not having much success with this ContentProvider issue. If there is anyone who can build a library to deal with this I'd really appreciate it. In fact, I'm willing to pay to have it done.
 
Upvote 0
Top