23.01.2018 Views

MICROSOFT_PRESS_EBOOK_PROGRAMMING_WINDOWS_8_APPS_WITH_HTML_CSS_AND_JAVASCRIPT_PDF

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

It’s also very important to remember that network status might have changed while the app was<br />

suspended. Apps that watch the networkstatuschanged event should also refresh their<br />

connectivity-related state within their resuming handler.<br />

As a final note, check out the Troubleshooting and debugging network connections topic in the<br />

documentation, which has a little more guidance on responding to network changes as well as network<br />

errors.<br />

Cost Awareness<br />

If you ever crossed between 3G roaming territories with a smartphone that’s set to automatically<br />

download email, you probably learned the hard way to disable syncing in such circumstances. I once<br />

drove from Washington State into Canada without realizing that I would suddenly be paying<br />

$15/megabyte for the privilege of downloading large email attachments. Of course, since I’m a<br />

law-abiding citizen I did not look at my phone while driving (wink-wink!) to notice the roaming<br />

network. Well, a few weeks later I knew what “bill shock” was all about!<br />

The point here is that if users conclude that your app is responsible for similar behavior, regardless of<br />

whether it’s actually true, the kinds of rating and reviews you’ll receive in the Windows Store won’t be<br />

good! It’s vital, then, to pay attention to changes in the cost of the connection profiles you’re using,<br />

typically the Internet profile. Always check these details on startup, within your networkstatuschanged<br />

event handler, and within your resuming handler.<br />

You—and all of your customers, I might add—can track your app’s network usage in the App History<br />

tab of Task Manager, as shown below. Make sure you’ve expanded the view by tapping More Details on<br />

the bottom left if you don’t see this view. You can see that it shows Network and Metered Network<br />

usage along with the traffic due to tile updates:<br />

636

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!