Networking on a Mobile Device1:45 with Ken Alger
Mobile devices can connect to the Internet in many different ways, and sometimes move from one type of connection to another in the same session. Our apps must adapt to these changing conditions so that our end users are not affected.
There are many, 0:00 many different ways of connecting to the internet in our world today. 0:00 Cable modems, DSL, wi-fi, cellular, satellite, and so on. 0:04 Any data we send back and 0:10 forth goes through multiple different networks along the way. 0:11 At any point during the journey something could happen. 0:15 Either on our end as a client, on the server side or with the network itself. 0:18 As developers, we need to make sure that our code and apps 0:24 can adapt to these changing conditions, insulating our users from problems. 0:27 When writing apps that involve any sort of networking code, 0:32 we need to keep the following points in mind. 0:35 Transfer only as much data as needed to complete the task. 0:38 Every network call costs the user time and battery life. 0:42 It can also cost them money if they're on a network that charges for data usage. 0:46 Avoid network timeouts. 0:50 Mobile connections can be slower and 0:53 you don't want something to stop loading just because it took too long. 0:55 Let users cancel networking operations. 0:58 Design interfaces that give users control over a network transaction. 1:02 For example, if you're building a podcasting or 1:06 video streaming app, the file size could be large. 1:09 Allow the user to pause the download and resume it when they choose. 1:12 Handle failures gracefully. 1:17 There are many reasons why a network might suddenly fail. 1:20 When this happens, we need to ensure that we account for these situations and 1:23 allow our apps to continue working as much as possible. 1:28 Finally, we must always keep the users security in mind. 1:32 You never know how secure your connection is. 1:36 So make sure to always take efforts to protect user data in 1:37 your application when writing networking code. 1:41
You need to sign up for Treehouse in order to download course files.Sign up