Well in our case it would be nice to be able to display a message to the user warning them that another application is already using the database and to close that application first if they wish to proceed.
You shouldn’t be killing the application from a worker thread - just send a message to the application saying you can’t continue and then exit the worker thread.
You probably shouldn’t be returning a Realm for the application to use until this has been checked anyway.
Similarly I think the SDK crashes the application with a fatal error if you try adding an object with a duplicate ID - again kind of weird to work like that - just return an error so the application can gracefully handle the situation. Its a pretty common problem with databases - even if the application checks for a duplicate ID prior to adding the object it is entirely possible that someone else might have added one between the time the check is performed and the call to add the object is made.
I am not aware that there is any way to link the check for duplicate ID with the call to add() as a transaction in Realm so the application should be left to handle the ‘duplicate key’ error rather than crashing the whole application. This isn’t a compile time check you can do but definitely a runtime check you should handle elegantly for the user.
Maybe I should raise this as a request on GitHub ? Would love to hear the arguments for simply crashing the application with a fatal error rather than returning an error.