ObjectBox 1.1 brings a data browser to view objects inside ObjectBox databases. This has become the most requested feature, so we are very happy about finally releasing it. The new data browser actually runs in the browser as it is an embedded web app. Thus, you can quickly check data on your device on the fly, or on your development machine to make use of your screen estate.
Setup
Because the object browser is a debugging tool, you should only use it for your debug builds. Your release builds should still use the regular “android-objectbox” artifact. Use this Gradle config before the line apply plugin: 'io.objectbox' :
1 2 3 4 5 6 | // ObjectBox browser dependencies must be set before applying ObjectBox plugin so it does not add objectbox-android // (would result in two conflicting versions, e.g. "Duplicate files copied in APK lib/armeabi-v7a/libobjectbox.so"). dependencies { debugCompile "io.objectbox:objectbox-android-objectbrowser:$objectboxVersion" releaseCompile "io.objectbox:objectbox-android:$objectboxVersion" } |
Because the object browser opens a http port locally for the browser app, you need to ensure your app also has the INTERNET permission:
1 | <uses-permission android:name="android.permission.INTERNET" /> |
In your app code, simply add those lines right after you created the BoxStore, e.g. in your Application class:
1 2 3 | if (BuildConfig.DEBUG) { new AndroidObjectBrowser(boxStore).start(this); } |
As you can see in the video, the object browser comes with a notification to quickly open it on your device.
Running on your dev machine
To open it on your development machine, check the Android locat logs. It will print the port and the ADB command needed to do the port forwarding. Because it usually uses port 8090, the command to run usually is:
1 | adb forward tcp:8090 tcp:8090 |
Once the port forwarding is in place you can open the browser using “http://localhost:8090/index.html” on the big screen.
ObjectBox 1.1 also come with other minor features and a couple of fixes. Check the changelog for details.
Screenshot
Lovely… I use Realm, but this is looking interesting, keep up the great work. Will surely try it:)
Can’t wait to replace my Realm integrations with this! Had real problems marrying rx with Realm’s threading requirements – this is just what the doctor ordered, thanks!
Wow, that’s great feature!