1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    2
    Vote Rating
    0
    sencha_pratik is on a distinguished road

      0  

    Default Unanswered: Request to server not working properly in Android & I phone.

    Unanswered: Request to server not working properly in Android & I phone.


    Hello,
    I making sencha touch application in which i am sending request after every 10 sec with user id,for server side if request calls within 40 sec then i am getting response true & other online users otherwise false.It working properly in chrome(desktop)i am getting response true after every 7sec but in I Phone or Android i am getting response false after every 7 sec, this what the actual problem i am facing so please help me on this.
    I am using following code.



    var task = new Ext.util.DelayedTask(function(){ this.get(); task.delay(10000); }, this); task.delay(0); get: function(){ Ext.Ajax.request({ url: 'resources/api/api.php' , scope: this , params: { cmd: 'msg' , to_fb_id: fb_id } , success: function(res, request){ var rec = Ext.decode(res.responseText); Ext.Msg.alert('success',''+rec.success); if(rec.success == true){ some condition } } });
    }
    I also tried with set Interval, set Timeout & JSONP request .

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,532
    Vote Rating
    871
    Answers
    3564
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    This sounds very familiar from another user...

    So you send a request frequently and on Chrome it returns true which is great. When you go to the Android and iPhone it returns false with same code.

    So the request needs to be evaluated on the phone versus on chrome. Is the url and params 100% the same? Are the headers correct?

    If those are 100% the same then we need to look at the PHP code. What variables are different between the Chrome and phone that is causing this and what is the cause to those variables to be different?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    2
    Vote Rating
    0
    sencha_pratik is on a distinguished road

      0  

    Default


    Hello Mitchellsimoens,
    Actually the request is used to check whether user login or not means on server side we are checking if this request comes within 40 sec then user is online & we get response true with other online users otherwise we are getting response false.
    So in our app what happens when we login from iPhone or Android it directly gives response false.(In it is working properly on desktop).

    Thank You.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,532
    Vote Rating
    871
    Answers
    3564
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    So it sounds like the time or session isn't saved. Cookies in iOS 5.1 (maybe 5.0) are turned off by default so if you are using a session then the cookie won't be saved to the device.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Tags for this Thread