Incorrect invokation of Geo Service CBL handlers

If we use the following sample code for the following handlers:

Business Logic - Geo Service Handler - beforeAddCategory()、 afterAddCategory()、 beforeDeleteCategory()、 afterDeleteCategory() 


    public boolean geoAddCategorySync(final String categoryName) {
        mRet = false;


        Thread thread = new Thread(new Runnable() {


            @Override
            public void run() {
                try {
                    GeoCategory category = Backendless.Geo
                            .addCategory(categoryName);
                    if (category.getName().equals(categoryName))
                        mRet = true;
                    else
                        mRet = false;
                } catch (Exception e) {
                    Log.e(TAG, e.toString());
                    mRet = false;
                }
            }


        });
        try {
            thread.start();
            thread.join();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return mRet;
    }

The correct invokation order is beforeAddCategory() and then afterAddCategory() but now we find that after beforeAddCategory() the method afterDeleteCategory() is mistakenly being called.

Hi, Simon.

Using this

Thread thread = new Thread(new Runnable() {...

denied in custom code.
You can find this information below:
https://backendless.com/compatibility-notice-using-async-api-calls-in-coderunner/

Regards,
Kate.

Hi, Kate.

I’m working with Simon. Please let me report again about this issue.

  • We are developing Android app, and using backendless geo service.
    And we are going to use Custom Business Logic’s pre/post event handlers. (Above source code which posted by Simon is Android code. Not Server code.)

  • When we use Backendless.Geo.addCategory() method from client side,
    We expect following event handler should be called on server.

    • beforeAddCategory();
    • afterAddCategory();
      But, actually following event handler has called.
    • beforeAddCategory(); /* this is correct */
    • afterDeleteCategory(); /* This should be “afterAddCategory()” */
  • It is not related whether called from sync or async method.
    It may reproduce from following Android code.

     public void geoAddCategorySync(final String categoryName) {
         GeoCategory category = Backendless.Geo
                 .addCategory(categoryName);
     }

Regards,
Niro.

Hi, Niro

This issue will be fixed in a few hours.
I will inform you about changes.

Regards,
Kate.

Hi, Niro!

Please, check again this issue.

Regards, Kate.

Hi, Kate.

We verified that the problem was fixed now.

Regards,
Niro.

Great! Thank you!