Skip to content

Commit a137eff

Browse files
[msid][docs-update] changes in the global signout section
1 parent 61184a2 commit a137eff

File tree

1 file changed

+17
-42
lines changed

1 file changed

+17
-42
lines changed

articles/active-directory/develop/tutorial-v2-shared-device-mode.md

Lines changed: 17 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -184,52 +184,27 @@ private void onSignInClicked()
184184

185185
### Globally sign out a user
186186

187-
The following removes the signed-in account and clears cached tokens from not only the app but also from the device that is in shared device mode:
187+
To receive the account change broadcast, you'll need to register a broadcast receiver.  It’s recommended to register your broadcast receiver via the Context. For more information about Context, [Context-registered receivers](https://developer.android.com/guide/components/broadcasts#context-registered-receivers)
188188
189-
```java
190-
private void onSignOutClicked()
191-
{
192-
mSingleAccountApp.signOut(new ISingleAccountPublicClientApplication.SignOutCallback()
193-
{
194-
@Override
195-
public void onSignOut()
196-
{
197-
updateSignedOutUI();
198-
}
199-
@Override
200-
public void onError(@NonNull MsalException exception)
201-
{
202-
/*failed to remove account with an exception*/
203-
}
204-
});
205-
}
206-
```
207-
208-
#### Broadcast receiver
209-
210-
To receive the account change broadcast, you will need to register a broadcast receiver.It’s recommended to register your broadcast receiver via the Context. For more information about context, see [Context-registered receivers](https://developer.android.com/guide/components/broadcasts#context-registered-receivers).
211-
212-
When an account change broadcast is received, immediately [get the signed in user and determine if a user has changed on the device](tutorial-v2-shared-device-mode.md#get-the-signed-in-user-and-determine-if-a-user-has-changed-on-the-device). If a change is detected, initiate data cleanup for previously signed-in account. It is recommended to properly stop any operations and do data cleanup.
189+
When an account change broadcast is received, immediately get the signed in user and determine if a user has changed on the device. If a change is detected, initiate data cleanup for previously signed-in account. It is recommended to properly stop any operations and do data cleanup.
213190
214-
The following code snippet shows how you could register a broadcast receiver.
191+
The following code snippet shows how you could register a broadcast receiver.
215192
216193
```java
217-
private static final String CURRENT_ACCOUNT_CHANGED_BROADCAST_IDENTIFIER = "com.microsoft.identity.client.sharedmode.CURRENT_ACCOUNT_CHANGED";
218-
219-
private BroadcastReceiver mAccountChangedBroadcastReceiver;
220-
221-
private void registerAccountChangeBroadcastReceiver(){
222-
    mAccountChangedBroadcastReceiver = new BroadcastReceiver() {
223-
        @Override
224-
        public void onReceive(Context context, Intent intent) {
225-
            //INVOKE YOUR PRIOR ACCOUNT CLEAN UP LOGIC HERE      
226-
        }
227-
    };
228-
    IntentFilter filter = new
229-
230-
IntentFilter(CURRENT_ACCOUNT_CHANGED_BROADCAST_IDENTIFIER);
231-
    this.registerReceiver(mAccountChangedBroadcastReceiver, filter);
232-
}
194+
private static final String CURRENT_ACCOUNT_CHANGED_BROADCAST_IDENTIFIER = "com.microsoft.identity.client.sharedmode.CURRENT_ACCOUNT_CHANGED";
195+
private BroadcastReceiver mAccountChangedBroadcastReceiver;
196+
private void registerAccountChangeBroadcastReceiver(){
197+
    mAccountChangedBroadcastReceiver = new BroadcastReceiver() {
198+
        @Override
199+
        public void onReceive(Context context, Intent intent) {
200+
            //INVOKE YOUR PRIOR ACCOUNT CLEAN UP LOGIC HERE      
201+
        }
202+
    };
203+
    IntentFilter filter = new
204+
205+
IntentFilter(CURRENT_ACCOUNT_CHANGED_BROADCAST_IDENTIFIER);
206+
    this.registerReceiver(mAccountChangedBroadcastReceiver, filter);
207+
}
233208
```
234209
235210
## Administrator guide

0 commit comments

Comments
 (0)