Results 1 to 3 of 3

Thread: detecting network connection in sencha

  1. #1

    Default detecting network connection in sencha

    Hello,
    Ii want to create an app which will first check if there is a connection to the internet.

    If there is, then pull the latest information via a JSON feed..if not pull up data from localstorage..

    how can i do this with sencha touch?

    thanks

  2. #2
    Touch Premium Member
    Join Date
    Jun 2010
    Posts
    22

    Default

    Sencha Touch doesn't provide any extra functionality around this AFAIK, but it's a pretty simple new javascript API per the HTML5 spec.

    Code:
    // This property is true if you are online, false if not
    window.navigator.onLine
    Of course you'll need to do some extra work like spec'ing a cache-manifest to have whatever local assets you need available offline in the first place (aside from local storage for the data you want to display).

  3. #3
    Sencha Premium User mrsunshine's Avatar
    Join Date
    Sep 2008
    Location
    Germany - Darmstadt
    Posts
    693

    Default

    afaik there is no api for it in st where you can check network.online?
    but you can make the normal request and on failure callback (no network) you load the data from the local store

Similar Threads

  1. Replies: 2
    Last Post: 3 Nov 2010, 10:03 AM
  2. Social network developer
    By vladok in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 3 Feb 2009, 4:13 PM
  3. Resume connection after network error
    By vahid4134 in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 22 Sep 2008, 8:54 AM
  4. does the css get anything to do with network?
    By wmercury in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 4 Sep 2008, 12:36 AM
  5. I want to display a network map, can i?
    By islem in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 10 Apr 2008, 4:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •