question

nirmal avatar image
nirmal Suspended asked rachel Deactivated commented

Unable to find logout event on clover mini using EmployeeConnector. How can we find that?

I am currently finding logout of employee onActiveEmployeeChanged(Employee employee) method of EmployeeConnector. It is working fine on clover station but onEmployeeChanged is not firing when logged out in clover mini. How can we found this?

Employees
2 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

rachel avatar image rachel commented ·

Can you Private Message me a pastebin of a minimal, complete, verifiable example, to help me reproduce this issue? Thank you.

0 Likes 0 ·
sam avatar image sam commented ·

Can you verify that your app was running on both instances (Station and Mini)? EmployeeConnector listener will only fire when the app is active (running in foreground or background).

0 Likes 0 ·

1 Answer

Mark Mullan avatar image
Mark Mullan Deactivated answered

Hi @Nirmal,

The ACTIVE_EMPLOYEE_CHANGED broadcast is fired both when an employee logs in and logs out. Register the receiver in the manifest:

    <receiver
        android:name=".MyBroadcastReceiver"
        android:exported="true">
        <intent-filter>
            <action android:name="com.clover.sdk.employee.intent.action.ACTIVE_EMPLOYEE_CHANGED" />
        </intent-filter>
    </receiver>

And then receive it:

public class MyBroadcastReceiver extends BroadcastReceiver {
    private static final String TAG = "MyBroadcastReceiver";
    @Override
    public void onReceive(Context context, Intent intent) {
        String employeeId = intent.getStringExtra(Intents.EXTRA_EMPLOYEE_ID);
        Log.d(TAG, "onReceive: " + employeeId);
    }
}

Logout events make employeeId == null

Cheers,

Mark

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community