Cómo abrir un SMS específico en android
¿Hay una manera de abrir la actividad de mensajería en android con un SMS específico?
- Android: cómo marcar sms como leído en onReceive
- Estructura de datos utilizada para mensajes SMS en Android
- Cómo desactivar mi aplicación sms como aplicación predeterminada en Android
- Cómo obtener el nombre del contacto al recibir SMS
- Android android.permission.SEND_SMS no funciona
- Caracteres especiales en sms de Android
- ¿Cómo enviar mi ubicación (longitud y latitud) como una respuesta sms a otra persona?
- Android 1.6 SMS (antiguo código de aplicación)
- Registro de SMS como en la aplicación para móviles: whatsapp
- Cómo enviar SMS con Delphi XE5 en Android
- Cómo enviar un SMS en Android Kitkat desde la aplicación no predeterminada sin escribir a SMS Provider
- Anular la aplicación predeterminada de mensajería de android
- Configuración única de Android SMS
threadId
debe ser el id del subproceso SMS / MMS que desea ver
Intent defineIntent = new Intent(Intent.ACTION_VIEW); defineIntent.setData(Uri.parse("content://mms-sms/conversations/"+threadId)); myActivity.startActivity(defineIntent);
Esta es la manera más simple que encontré
Prueba esto
int req_thread_id; Uri mSmsinboxQueryUri = Uri.parse("content://sms")); Cursor cursor1 = getContentResolver().query( mSmsinboxQueryUri, new String[] { "_id", "thread_id", "address", "person", "date", "body", "type" }, null, null, null); startManagingCursor(cursor1); if (cursor1.getCount() > 0) { while (cursor1.moveToNext()) { int thread_id = cursor1.getInt(1); String address; = cursor1.getString(cursor1 .getColumnIndex(columns[0])); if("your desired no".equals(address) req_thread_id = thread_id; } } Intent defineIntent = new Intent(Intent.ACTION_VIEW); defineIntent.setData(Uri.parse("content://mms-sms/conversations/"+req_thread_id)); myActivity.startActivity(defineIntent);
Escogí esto de la fuente para la aplicación de mensajería ( líneas 311-315 ), así que estoy bastante seguro de que va a funcionar, pero no tengo ninguna experiencia con él.
// threadId should be the id of the sms/mms thread you want to view long threadId = 0; Intent i = new Intent("com.android.mms"); i.setData( Uri.withAppendedPath( i.getData(), Long.toString(threadId) ) ); i.setAction(Intent.ACTION_VIEW);
Este fragmento es de un comentario en la respuesta aceptada. Publicar el método aquí para la posteridad.
public static long findThreadIdFromAddress(Context context, String address) { if (address == null) return 0; String THREAD_RECIPIENT_QUERY = "recipient"; Uri.Builder uriBuilder = THREAD_ID_CONTENT_URI.buildUpon(); uriBuilder.appendQueryParameter(THREAD_RECIPIENT_QUERY, address); long threadId = 0; Cursor cursor = null; try { cursor = context.getContentResolver().query( uriBuilder.build(), new String[] { Contacts._ID }, null, null, null); if (cursor != null && cursor.moveToFirst()) { threadId = cursor.getLong(0); } } finally { if (cursor != null) { cursor.close(); } } return threadId; }
- Cómo volver a crear todos los fragmentos en ViewPager:
- Android – google map mover la cámara de una posición a otra