-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Si tiene problemas es por la ruta de vuforia.jar
-Todo lo que se lleva de pepsico a vuforia
- Loading branch information
Showing
55 changed files
with
2,059 additions
and
28 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package com.devworms.pepsico; | ||
|
||
|
||
import android.os.AsyncTask; | ||
import android.util.Log; | ||
|
||
import com.devworms.pepsico.pojo.menuPojo; | ||
|
||
import org.json.JSONArray; | ||
import org.json.JSONObject; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import okhttp3.MediaType; | ||
import okhttp3.OkHttpClient; | ||
import okhttp3.Request; | ||
import okhttp3.Response; | ||
|
||
|
||
/** | ||
* Created by sergio on 29/05/16. | ||
*/ | ||
public class ApiRest { | ||
|
||
public static List<menuPojo> consultarListadoMenu(String dia) { | ||
|
||
List<menuPojo> lMenu = new ArrayList<menuPojo>(); | ||
|
||
try { | ||
Log.d("RestApi","respuesta consulta"); | ||
|
||
OkHttpClient client = new OkHttpClient(); | ||
|
||
MediaType mediaType = MediaType.parse("application/octet-stream"); | ||
Request request = new Request.Builder() | ||
.url("http://app-pepsico.palindromo.com.mx/APP/"+dia+".php") | ||
.get() | ||
.build(); | ||
JSONArray values = new RequestApi().execute(request).get(); | ||
Log.d("RestApi","respuesta "+ values.length()); | ||
for (int i = 0; i < values.length(); i++) { | ||
|
||
JSONObject sensorApi = values.getJSONObject(i); | ||
menuPojo menPojo = new menuPojo(); | ||
Log.d("RestApi","respuesta "+sensorApi.getString("id")); | ||
menPojo.setId(sensorApi.getString("id")); | ||
Log.d("RestApi","respuesta "+sensorApi.getString("nombre")); | ||
menPojo.setNombre(sensorApi.getString("nombre")); | ||
Log.d("RestApi","respuesta "+sensorApi.getString("salon")); | ||
menPojo.setSalon(sensorApi.getString("salon")); | ||
Log.d("RestApi","respuesta "+sensorApi.getString("horario")); | ||
menPojo.setHorario(sensorApi.getString("horario")); | ||
Log.d("RestApi","respuesta "+sensorApi.getString("codigo")); | ||
menPojo.setCodigo(sensorApi.getString("codigo")); | ||
Log.d("RestApi","respuesta "+sensorApi.getString("img")); | ||
// menPojo.setRecomendaciones(sensorApi.getString("img")); | ||
Log.d("RestApi","respuesta "+sensorApi.getString("dia")); | ||
menPojo.setFecha(sensorApi.getString("dia")); | ||
lMenu.add(menPojo); | ||
} | ||
} | ||
catch (Exception ex){ | ||
|
||
} | ||
|
||
return lMenu; | ||
} | ||
|
||
private static class RequestApi extends AsyncTask<Request, Void, JSONArray> { | ||
@Override | ||
protected JSONArray doInBackground(Request... params) { | ||
try { | ||
|
||
OkHttpClient client = new OkHttpClient(); | ||
Response response = client.newCall(params[0]).execute(); | ||
|
||
String string = response.body().string(); | ||
JSONArray jsonObjects = new JSONArray(string); | ||
|
||
return jsonObjects; | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
return null; | ||
} | ||
|
||
} | ||
} | ||
} |
Oops, something went wrong.