Getting Resource Delta

To get delta from mobile platform server, create the DeltaStreamSapActivity application, which uses the deltaStream method implemented in the RequestAPI unit.

Before creating an application make sure that resource parameter cache of SAP data source is available.

The DeltaStreamSapActivity application includes one screen and buttons:

To view application work results, use the interactive example:

  1. Click the DELTASTREAMSAP button.

public class DeltaStreamSapActivity extends AppCompatActivity {
   private static final String MY_URL = "http://testmasterfmp.fsight.cloud";
   private static final VersionAPI MY_VERSION_API = VersionAPI.V_1;
   private static final String MY_ENVIRONMENT = "Leonid_environment";
   private static final String MY_PROJECT = "Leonid_project";
   private static final String MY_VERSION = "v1";
   private static final String MY_LOGIN = "Leonid";
   private static final String MY_PASSWORD = "123123";
   private static final String MY_RESOURCE = "study";
   private static final String TAG = "_TableStreamSapActivity";
 
   private HyperHive hyperHive;
   private TextView textView;
 
   @Override
   protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_delta_stream_sap);
       textView = findViewById(R.id.text_view_delta_stream_sap);
 
       Handler uiHandler = new Handler();
 
       hyperHive = new HyperHiveState(getApplicationContext())
               .setHostWithSchema(MY_URL)
               .setApiVersion(MY_VERSION_API)
               .setEnvironmentSlug(MY_ENVIRONMENT)
               .setProjectSlug(MY_PROJECT)
               .setVersionProject(MY_VERSION)
               .setHandler(uiHandler)
               .buildHyperHive();
       authentication();
   }
 
   public void authentication() {
       boolean status = hyperHive.authAPI.auth(MY_LOGIN, MY_PASSWORD, true).execute().isOk();
       showStatus(status);
   }
 
   // Get delta
   public void deltaStreamSap(View view) {
       String response = hyperHive.requestAPI.deltaStream(MY_RESOURCE).execute().toString();
       textView.setText(response);
   }
 
   // Get table data
   public void showDataFromTable(View view){
       String response = hyperHive.databaseAPI.query("SELECT * FROM " + MY_RESOURCE + "_ET_DATA", StatusSelectTable.class).execute().toString();
       textView.setText(response);
   }
 
   public void showStatus(boolean status) {
       Log.d(TAG, "auth: " + status);
       Toast.makeText(this, "auth: " + status, Toast.LENGTH_LONG).show();
   }
}

See also:

Examples of Android Framework Use | Examples of Working with Resources