@Override
 public void onResume() {
   super.onResume();
   // When the app resumes, open the datastore and start listening for changes.
   if (mDatastore == null && mAccountManager.hasLinkedAccount()) {
     try {
       mDatastore = DbxDatastore.openDefault(mAccountManager.getLinkedAccount());
       DbxTable table = mDatastore.getTable("state");
       table.setResolutionRule("level", DbxTable.ResolutionRule.MAX);
       mDatastore.addSyncStatusListener(mDatastoreListener);
       updateLevel();
     } catch (DbxException e) {
       e.printStackTrace();
     }
   }
 }