Results 1 to 6 of 6

Thread: Newby question

  1. #1
    Sencha Premium User
    Join Date
    Mar 2011
    Location
    Castle Rock, CO
    Posts
    133
    Answers
    1

    Default Answered: Newby question

    I'm new to the touch environment and have just been trying to get grounded in the whole process. I've created a simple 2.4.2 touch app that is just attempting to retrieve some data. I've tested my app in chrome and it's working fine. I've configured the app native build process for phonegap. I'm using CMD 5.1.3. When I test the mobile app on the phone the data retrieval fails. The code used to retrieve the data:
    Code:
            Ext.data.JsonP.request({
                url: '//api.worldweatheronline.com/free/v1/weather.ashx',
                params: {
                    key: this.API_KEY,
                    q: '100',
                    format: 'json',
                    num_of_days: 1
                },
                success: function(result, request) {
                    //console.log(result.data);
                    try {
                        Ext.Msg.alert("Error", 'Success');
                    } catch (e) {
                        if (result.data.error) {
                            Ext.Msg.alert("Error", result.data.error[0].msg);
                        } else {
                            Ext.Msg.alert("Oops", e);
                        }
                    }
                },
                failure: function(e) {
                    Ext.Msg.alert("Oops", "Can not request data from worldweatheronline.com");
                }
            });
    The config.xml I'm using is the standard one generated by the phonegap init with just the name and description values changed. This seems so simple, yet I can't get it to work. Any suggestions or help would be appreciated.

    Thanks,
    Gordon

  2. I see. You must add <allow-navigation ... >, allow intent is for controls which URLs the app is allowed to ask the system to open. See docs:
    https://github.com/apache/cordova-plugin-whitelist

  3. #2
    Sencha User
    Join Date
    Aug 2010
    Posts
    315
    Answers
    4

    Default

    Hi, you have to whitelist the domain(s) you are accessing from the app in config.xml.
    https://cordova.apache.org/docs/en/l...ist/index.html

  4. #3
    Sencha Premium User
    Join Date
    Mar 2011
    Location
    Castle Rock, CO
    Posts
    133
    Answers
    1

    Default

    Hello Steve-

    Thanks for responding. I've been hacking at this for at least a week and I have looked at this. The generated config.xml (from my reading) defaults to all, so this is what the whitelist portion of my config looks like:
    Code:
        <access origin="*" /> 
        <plugin name="cordova-plugin-whitelist" version="1" />
        <allow-intent href="http://*/*" />
        <allow-intent href="https://*/*" />
        <allow-intent href="tel:*" />
        <allow-intent href="sms:*" />
        <allow-intent href="mailto:*" />
        <allow-intent href="geo:*" />
    Shouldn't this work? Am I missing something?
    Thanks,
    Gordon

  5. #4
    Sencha User
    Join Date
    Aug 2010
    Posts
    315
    Answers
    4

    Default

    Which OS you are trying? Which version of Cordova? Not the cli version, but the specific cordova version for the os

  6. #5
    Sencha User
    Join Date
    Aug 2010
    Posts
    315
    Answers
    4

    Default

    I see. You must add <allow-navigation ... >, allow intent is for controls which URLs the app is allowed to ask the system to open. See docs:
    https://github.com/apache/cordova-plugin-whitelist

  7. #6
    Sencha Premium User
    Join Date
    Mar 2011
    Location
    Castle Rock, CO
    Posts
    133
    Answers
    1

    Default

    I also added to the widget xmlns:android="http://schemas.android.com/apk/res/android"I was using cordova 6.0.0 and phonegap 6.0.1Thanks Steve!!

Similar Threads

  1. newby Question, what component to use (see enclosed a sketch)
    By chris_nl in forum Sencha Touch 2.x: Q&A
    Replies: 17
    Last Post: 7 Jan 2012, 8:17 AM
  2. Newby Question
    By mikeamiller in forum Sencha Touch 2.x: Q&A
    Replies: 2
    Last Post: 21 Dec 2011, 9:48 PM
  3. Blank Page showing -- Super Newby Question
    By shizny in forum Sencha Touch 1.x: Discussion
    Replies: 3
    Last Post: 30 May 2011, 3:09 PM

Posting Permissions

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