Germain UX allows you to monitor all kind of transactions in your application. To enable this monitoring you need to programmatically set a start of a transaction (GermainAPM.startTransaction()) and an end of a transaction(GermainAPM.endTransaction()). Example below shows how to use transaction monitoring for your async tasks (e.g. http request) but you can use it the same way for all other type of transactions (User transactions, Business oriented transactions. SQL transactions, ...).

Java:

public class MyAsyncTask extends AsyncTask<Void, Void, Void> {

    private String txnName = "Image Download"; // example of transaction name used in startTransaction() and endTransaction()

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        GermainAPM.startTransaction(txnName, "MyViewName", "ImageName"); // start your transaction (you must provide a unique transaction name and optionally view/activity name where transaction occurs and some additional information related to the transaction
        // ...
    }

    @Override
    protected Void doInBackground(Void... voids) {
        // ...
        try {
            URL url = new URL("...");
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setRequestMethod("GET");
		    // ...
            conn.connect();
            conn.getResponseMessage();
        } catch (IOException e) {
            e.printStackTrace();
        }
        // ...
        return null;
    }

    @Override
    protected void onPostExecute(Void result) {
        // ...
        GermainAPM.endTransaction(txnName);
    }
}
JAVA

Kotlin:

class MyAsyncTask() : AsyncTask<Void, Void, Void> {

    var txnName: String = "Image Download"; // example of transaction name used in startTransaction() and endTransaction()

    override fun onPreExecute() {
        super.onPreExecute()
        GermainAPM.startTransaction(txnName, "MyViewName", "ImageName") // start your transaction (you must provide a unique transaction name and optionally view/activity name where transaction occurs and some additional information related to the transaction
        // ...
    }

    override fun doInBackground(vararg params: Void?): Void? {
        // ...
        try {
            URL url = new URL("...")
            HttpURLConnection conn = (HttpURLConnection) url.openConnection()
            conn.setRequestMethod("GET")
		    // ...
            conn.connect()
            conn.getResponseMessage()
        } catch (e: IOException) {
            e.printStackTrace()
        }
        // ...
        return null
    }

    override fun onPostExecute(result: String?) {
        // ...
        GermainAPM.endTransaction(txnName)
    }
}
JAVA

Component: Mobile App

Feature Availability: 8.6.0 or later