Hello i have created an android app that uses a custom content provider named CustomCP, it implements all methods and everything works fine while managing data inside the ap
Yes, it's possible to access a custom content provider from another app. Using your terminology we'll call the content provider CustomCP and the other app AppA. (AppA is the one that wants to access to the provider). This approach is proven to work:
Specify the desired content provider (CustomCP) from within AppA by using a ContentProviderClient:
Uri yourURI = Uri.parse("content://com.example.customcp/YourDatabase");
ContentProviderClient yourCR = getContentResolver().acquireContentProviderClient(yourURI);
Access the content provider as you would normally from App A. For example:
yourCursor = yourCR.query(yourURI, null, null, null, null);
Note: you must either enclose the code within a try/catch block or include a "throws RemoteException" since the provider is not in App A.
CustomCP's Manifest must specify the provider, include the permissions allowed (e.g., read and/or write), and the provider must be exported. Here's an example: