Skip to content

Instantly share code, notes, and snippets.

@ryansgot
Last active June 8, 2018 03:56
Show Gist options
  • Save ryansgot/204d7f44640e6b42830fb5b85775053f to your computer and use it in GitHub Desktop.
Save ryansgot/204d7f44640e6b42830fb5b85775053f to your computer and use it in GitHub Desktop.
ForSureDB Example App.java (contentprovider)
import android.app.Application;
import com.fsryan.forsuredb.FSDBHelper;
import com.fsryan.forsuredb.ForSureAndroidInfoFactory;
import com.fsryan.forsuredb.gsonserialization.FSDbInfoGsonSerializer;
import com.fsryan.forsuredb.api.FSTableCreator;
public class App extends Application {
@Override
public void onCreate() {
super.onCreate();
String authority = "com.fsryan.example.forsuredb.content";
List<FSTableCreator> tables = TableGenerator.generate(authority);
FSDbInfoSerializer serializer = new FSDbInfoGsonSerializer();
if (BuildConfig.DEBUG) {
FSDBHelper.initDebug(this, "example-debug.db", tables, serializer);
} else {
FSDBHelper.init(this, "example.db", tables, serializer);
}
ForSureAndroidInfoFactory.init(this, authority);
ForSure.init(ForSureAndroidInfoFactory.inst());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment