ActivityScope(Activity activity) { Instance = activity; activityIdentity = ActivityIdProvider.GetNextId(); listener = new ActivityScopeListener(); listener.ActivityStateChanged += HandleActivityStateChanged; activity.Application.RegisterActivityLifecycleCallbacks(listener); }
public void Dispose() { if (listener != null) { listener.ActivityStateChanged -= HandleActivityStateChanged; Instance.Application.UnregisterActivityLifecycleCallbacks(listener); listener = null; } }