if this is the only way available by the API, then you have to use it if you have a control over what startOAuth2Authentication do, you can use startActivityForResult() , but its inside API you can't change it.
so i would suggest you handle whatever exceptions you get at onResume() by using some validations, like wrapping whole code inside onResume() with this
if(mDBApi!=null){...