¿Cómo usar correctamente la biblioteca Volley con IntentService?
Tengo un problema con la biblioteca Volley. Estoy probando esta biblioteca y recibo un error después de 10 minutos en Samsung S5.
A continuación se muestra mi código de ejemplo simple:
- No se puede resolver el símbolo
- Java lanza NotSerializableException después de agregar su propia interfaz
- Cadena está siendo truncado cuando es demasiado largo
- Hilo saliendo con excepción no captada
- Cómo utilizar el lector de PDF Radaee sdk
public class SimpleWakefulService extends IntentService { public SimpleWakefulService() { super("SimpleWakefulService"); } boolean success = true; JSONArray t = new JSONArray(); JSONArray o = new JSONArray(); JSONArray m = new JSONArray(); @Override protected void onHandleIntent(Intent intent) { RequestQueue queue = Volley.newRequestQueue(this); StringRequest postRequest = new StringRequest(Request.Method.POST, PROT + "://" + REMOTE + "/" + DIR + "/repeat.php", new Response.Listener<String>() { @Override public void onResponse(String response) { try { JSONObject result = new JSONObject(response); success = result.getBoolean("success"); t = result.getJSONArray("t"); o = result.getJSONArray("o"); m = result.getJSONArray("m"); } catch (JSONException e) { e.printStackTrace(); } Intent intent = new Intent(getApplicationContext(), Zlecenia.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); alarm(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { searchsignal(); } } ) { @Override protected Map<String, String> getParams() { GlobalConfig config = new GlobalConfig(); JSONObject json = config.getConfig(); JSONObject location = config.getLocation(); JSONObject data = new JSONObject(); try { data.put("ID", json.getString("ID")); data.put("session", json.getString("session")); if(location != null) { data.put("latitude", location.getString("latitude")); data.put("longitude", location.getString("longitude")); } if(Strefa.Tabela){ data.put("tabela", true); } } catch (JSONException e) { e.printStackTrace(); } Map<String, String> params = new HashMap<String, String>(); params.put("json", data.toString()); return params; } }; postRequest.setRetryPolicy(new DefaultRetryPolicy( 5000, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT)); queue.add(postRequest); SimpleWakefulReceiver.completeWakefulIntent(intent); } public void alarm() { Intent intent = new Intent(this, SimpleWakefulReceiver.class); GlobalConfig.pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0); GlobalConfig.alarmManager = (AlarmManager) this.getSystemService(ALARM_SERVICE); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { GlobalConfig.alarmManager.setExact(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + 3000, GlobalConfig.pendingIntent); } else { GlobalConfig.alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + 3000, GlobalConfig.pendingIntent); } } }
Me siento y observo en la pantalla. Estoy esperando … mi espacio disminuye, que después de 10 minutos para ver error:
03-15 13:36:29.121 10969-11275/com.example.seadog.gps E/qdmemalloc: ion: Failed to map memory in the client: Out of memory 03-15 13:36:29.121 10969-11275/com.example.seadog.gps E/qdgralloc: Could not mmap handle 0x6210d100, fd=50 (Out of memory) 03-15 13:36:29.121 10969-11275/com.example.seadog.gps E/qdgralloc: gralloc_register_buffer: gralloc_map failed 03-15 13:36:29.121 10969-11275/com.example.seadog.gps W/GraphicBufferMapper: registerBuffer(0x6210d100) failed -12 (Out of memory) 03-15 13:36:29.121 10969-11275/com.example.seadog.gps E/GraphicBuffer: unflatten: registerBuffer failed: Out of memory (-12) 03-15 13:36:29.121 10969-11275/com.example.seadog.gps E/Surface: dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -12 03-15 13:36:29.121 10969-11275/com.example.seadog.gps W/Adreno-EGLSUB: <DequeueBuffer:720>: dequeue native buffer fail: Out of memory, buffer=0x0, handle=0x0 03-15 13:36:29.121 10969-11275/com.example.seadog.gps W/Adreno-EGL: <qeglDrvAPI_eglSwapBuffers:3702>: EGL_BAD_SURFACE 03-15 13:36:29.121 10969-11275/com.example.seadog.gps W/OpenGLRenderer: swapBuffers encountered EGL_BAD_SURFACE on 0x621739c0, halting rendering... 03-15 13:36:29.151 10969-11275/com.example.seadog.gps A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x54 in tid 11275 (RenderThread)
- Android: ¿Cómo importar el contacto desde el teléfono?
- Cómo revertir una transacción en Android?
- Excepción al iniciar sesión con Simple API de Facebook (Sesión: se ha intentado abrir una sesión que tiene una solicitud pendiente)
- Android: No se puede obtener un encabezado / pie de lista ListView que se puede hacer clic
- Proguard elimina clase Anonymous en clase Anonymous en Java
- Marco basado en JSF para sitios web táctiles
- Altura de la vista de notificación de estado personalizado de Android
- Base de datos SQLite en android y java
- Abra todas las imágenes de una carpeta (tarjeta SD) al mismo tiempo, haga clic en el botón
- Un RealmObject sin @PrimaryKey no se puede actualizar