Windows Phone 7 - 当互联网连接不可用时关闭或不初始化应用程序
我正在开发一个完全依赖互联网的应用程序。这样我就可以检测互联网连接是否可用。但问题是,如果互联网连接不可用,我必须关闭应用程序,否则应用程序不应初始化。
我真正需要的是这个。两种情况,一种有互联网连接可用,另一种则没有。当应用程序通过互联网连接打开时,一切都会正常。
当互联网连接不可用并且应用程序打开时,它应该显示一个消息框,内容为“抱歉,没有找到互联网连接。应用程序正在关闭”
并返回到开始屏幕。
I am developing an application which is fully depended on internet. So i can detect if the internet connection is available or not. But the problem is if the internet connection is not available i have to close the application or the application shouldn't be initialized.
What exactly i need is this. Two Scenarios one with internet connection available and other is not. When the application is opened with internet connection everything will be normal.
When internet connection is not available and the application is opened it should show a message box saying "Sorry no internet connection is found. Application is now closing"
and go back to start screen.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您这样做,您的应用程序将无法获得市场认证。即使出现该错误,您的应用程序也必须具有响应能力。
我建议您创建一个占位符,以防没有连接。
If you do this your App would not be certified to the marketplace. Even with that error, your app must be responsive.
I suggest you to create a placeholder in case there is no connection.
更好的是引入一个选项,例如摇动以重新尝试连接(例如 Facebook 应用程序)。什么都不做,并强制重新启动应用程序是一种糟糕的用户体验,而且工艺很差。
正如 MSicc 所提到的,任何应用程序都会以除 via 之外的任何其他方式关闭。后退按钮将无法通过市场认证。
移动应用程序在许多情况下需要承受缓慢/无连接的情况,即使您正在进行需要互联网访问的操作,它也需要负责。如果不是,用户会给你差评,最终没有人会使用你的应用程序。
Better is to introduce a option, like shake to re-try connecting (like the Facebook app). Just doing nothing, and enforcing a re-start of the application is a terrible user experience, and just poor craftsmanship.
And as mentioned by MSicc, any app closing down in any other way than via. the back-button, won't pass marketplace certification.
A mobile app needs to endure slow/no-connections in many situations, and it needs to be responsible even if you're doing a operation that requires internet access. If it's not, users will give you bad ratings, and nobody will use your app in the end.
实际上有一种 XNA 支持的方式。
Actually there is a way that is supported with XNA.