Created
July 18, 2017 08:01
-
-
Save florent37/0ff302882d984a83f7e22f9cb2225eec to your computer and use it in GitHub Desktop.
Retrieve app context
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package florent37.github.com.rxcomponentlifecycle; | |
import android.app.Application; | |
import android.content.ContentProvider; | |
import android.content.ContentValues; | |
import android.content.Context; | |
import android.database.Cursor; | |
import android.net.Uri; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.Nullable; | |
/** | |
Add This into your library Manifest | |
<provider | |
android:name=".MyContentProvider" | |
android:authorities="yourpackage.MyContentProvider" | |
android:exported="false" | |
android:multiprocess="true" /> | |
*/ | |
public class MyContentProvider extends ContentProvider { | |
@Override | |
public boolean onCreate() { | |
final Application application = (Application) getContext(); | |
//initialise your library here | |
return false; | |
} | |
@Nullable | |
@Override | |
public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) { | |
return null; | |
} | |
@Nullable | |
@Override | |
public String getType(@NonNull Uri uri) { | |
return null; | |
} | |
@Nullable | |
@Override | |
public Uri insert(@NonNull Uri uri, @Nullable ContentValues values) { | |
return null; | |
} | |
@Override | |
public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) { | |
return 0; | |
} | |
@Override | |
public int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection, @Nullable String[] selectionArgs) { | |
return 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment