You should do network operations ( such as getting information from an API ) on another thread, or a NetworkOnMainThread exception will be thrown when your code runs, since blocks runs on the Main thread, see the example codes above to know how to run your code on a new thread, with the AsynchUtil class for example.
2 Likes