Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

[-10204] Communication with the server failed with status code: 404-Android Offline store

Hi,

I am trying to open offline store in my Android Native app, But i couldn't do it successfully. I am getting "com.sap.smp.client.odata.exception.ODataNetworkException: Unknown network error occured". The callback for setofflinelistener is called, and offlinestore state changes from "offlinestore" opening then Initializing then populating, atlast offlineStoreOpenFailed is called. But, I can open onine store successfully, Can anyone help me to resolve this issue. I have given the code snippet below for offline store.

CODE:

private boolean OpenOfflineStore() throws OfflineODataStoreException

  {

  if (offlineStore==null){

  try {

  //This instantiate the native UDB libraries which are located in the

   //libodataofflinejni.so file

    ODataOfflineStore.globalInit();   

          LogonCoreContext lgCtx = LogonCore.getInstance().getLogonContext();

          String endPointURL = lgCtx.getAppEndPointUrl();

          URL url = null;

          try {

              url = new URL(endPointURL);

          } catch (MalformedURLException e) {

              e.printStackTrace();

          }

  

  

          ODataOfflineStoreOptions options = new ODataOfflineStoreOptions();

          options.host = url.getHost();

          options.port = String.valueOf(url.getPort());

  

  

          options.enableHTTPS = lgCtx.isHttps();

          options.serviceRoot= endPointURL;

          Log.e("Connection id", "" + lgCtx.getConnId());

  

  

          String appConnID = lgCtx.getConnId();

          options.customHeaders.put("X-SMP-APPCID", appConnID);

  

          CredentialsProvider credProvider = CredentialsProvider.getInstance(lgCtx);

          HttpConversationManager manager = new CommonAuthFlowsConfigurator(this).

                  supportBasicAuthUsing(credProvider).configure(new HttpConversationManager(this));

          options.conversationManager = manager;

  

  

          options.enableRepeatableRequests = false;

          options.storeName="store name";

  

  

          options.definingRequests.put("Notifications","Projects");

  

  

          offlineStore = new ODataOfflineStore(this);

          offlineStore.setOfflineStoreListener(this);

  

  

          try {

              Log.e("","OpenOfflineStore: open");

              offlineStore.openStoreSync(options);

            }

      catch(Exception e)

      {

            e.printStackTrace();

      }

  return true;

  } catch (Exception e) {

  throw new OfflineODataStoreException(e);

  }

  } else {

  return true;

  }

  //END

  }

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question