Skip to content

Commit

Permalink
handle responses outside of background mode
Browse files Browse the repository at this point in the history
  • Loading branch information
elringus committed Aug 21, 2018
1 parent 9116946 commit c940613
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,11 @@ private void ExecuteFullAuth ()
Application.OpenURL(authRequest);

// Wait for the authorization response.
httpListener.BeginGetContext(HandleHttpListenerCallback, httpListener);
var asyncResult = httpListener.BeginGetContext(HandleHttpListenerCallback, httpListener);

// Block the thread when backround mode is not supported to serve HTTP response while the application is not in focus.
if ((Application.isMobilePlatform && !Application.isEditor) || !Application.runInBackground)
asyncResult.AsyncWaitHandle.WaitOne();
}

private void HandleHttpListenerCallback (IAsyncResult result)
Expand Down

0 comments on commit c940613

Please sign in to comment.