0

The following call,

$http.get('//pruebarails-alevale.c9.io/').
        success(function(data, status, headers, config) {
          console.log('Success in getFromApi');
          console.log(data);
          console.log(data.messages); //undefined (only in mobile)
        }).
        error(function(data, status, headers, config) {
            console.error('Fail en getFromApi!');
        });

instead of printing the JSON in the ANDRIOD APP is printing this.

start("/");

I/chromium( 2225): addRow("..","..",1,"0 B","5/21/15, 2:03:25 PM");

I/chromium( 2225): addRow("acct","acct",1,"0 B","5/21/15, 2:03:25 PM");

I/chromium( 2225): addRow("cache","cache",1,"4.0 kB","5/21/15, 1:40:49 PM");

I/chromium( 2225): addRow("config","config",1,"0 B","5/21/15, 2:03:25 PM");

I/chromium( 2225): addRow("d","d",1,"0 B","5/21/15, 2:03:25 PM");

. . . ", source: file:///android_asset/www/js/services.js (43)

the CSP i have is

object-src 'self' https://pruebarails-alevale.c9.io/ 'unsafe-eval'

but any other CSP is rejected. THis also ONLY happen in the phone, in the browser it works perfectly and the console.log(data.messages); shows the right data

Alejandro Vales
  • 2,816
  • 22
  • 41
  • probably a CORS issue since Cordova 5.0.0 & whitelist plugin => see my POSt here : http://stackoverflow.com/a/30135532/3687474 – aorfevre May 21 '15 at 13:04
  • sorry, but it is still not solved, it's like my call to the URL ('pruebarails-alevale.c9.io/') give's back this strange things isntead of the JSON Object. – Alejandro Vales May 21 '15 at 13:44

1 Answers1

0

Ok, after beeing struggling with this for a while, my error was that i didn't pu a valid route, so it was trying to access to the file //pruebarails-alevale.c9.io/ in my mobile, (obviously the browser was correctly interpreting this, but not the phone)

Also i had to add the cordova whitelist pluging and allow all the access to third part aplications.

Hope it will help other people that had problems with the app

Alejandro Vales
  • 2,816
  • 22
  • 41