jquery mobile - Phonegap android project works on emulator and in some devices but not in a 2.2 android device -
im making phonegap application (phonegap 2.9 + jquery 1.8.3 + jquery mobile 1.3.1) works in: -4.3 android device. -4.0 android device. -2.2 android virtual device.
the problem im having issues when install in android 2.2.2 device. of api calls work , others dont.
for example, call works:
$.ajax({ data: {museum_id:'1'}, url: url+'index.php?r=api/listallcuriosities', type: 'get', success: function (response) { var resultado = response['data']; var listadohtml = ''; (var i=0;i<resultado.length;i++){ listadohtml += '<ul data-role="listview" data-theme="b" class="titulos"><li>'+resultado[i]['title']+'</li></ul>' +' <p>'+ resultado[i]['description']+'</p>'; } $('#listcuriosities').html(listadohtml); $('#listcuriosities').trigger('create'); }, error: function() { //something went wrong, handle error , display message alert('se ha producido un error en la llamada al servidor'); } });
but other doesn't
$.ajax({ data: {museum_id:'1'}, url: url+'index.php?r=api/listmasterpieces', type: 'get', success: function (response) { var visitedlist = json.parse(window.localstorage.getitem("visited")); var resultado = response['data']; var listadohtml = '<div>'; var author = ''; (var i=0;i<resultado.length;i++){ var item = ''; var isvisited = 'data-theme="a"'; if(visitedlist!=null && resultado[i]['id'] in visitedlist && visitedlist[resultado[i]['id']]==1){ isvisited = 'data-theme="b" data-icon="check"'; } if(resultado[i]['authorname']!=author){ // en caso de que el autor haya cambiado se insertará una nueva lĂnea item += '<ul data-role="listview" data-theme="b"><li>'+resultado[i]['authorname']+'</li></ul>'; author = resultado[i]['authorname']; } var id = resultado[i]['id']; item += '<p><a href="detalle.html?id='+id+'" id="enlace-'+id+'" data-role="button" data-ajax="false" data-prefetch="false" '+isvisited+'>'+resultado[i]["name"] + '</a></p>'; listadohtml += item; } listadohtml += '</div>'; $('#listamasterpieces').html(listadohtml); $('#listamasterpieces').trigger('create'); }, error: function() { //something went wrong, handle error , display message alert('se ha producido un error en la llamada al servidor'); } });
i think can be: -because of a permissions problem (as can see store information in device) -because jquery doesnt work (i dont see alert of error ajax-method)
i attach manifest:
<supports-screens android:largescreens="true" android:normalscreens="true" android:smallscreens="true" android:resizeable="true" android:anydensity="true" /> <uses-permission android:name="android.permission.read_phone_state" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-sdk android:minsdkversion="8" android:targetsdkversion="17" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="com.museum.prado.mainactivity" android:label="@string/app_name" android:configchanges="orientation|screensize" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> </application>
thanks in advance
thanks @raoul george discovered problem.
when make:
var visitedlist = json.parse(window.localstorage.getitem("visited"));
in android 4 nothing happens, if work android 2.2 need sure window.localstorage.getitem("visited") has value.
Comments
Post a Comment