Парсинг сообщения mms для извлечения изображения

Мне удалось подключиться к серверу MMS и получить данные MMS.

Теперь мне нужно проанализировать данные MMS (byte[] responseArray) и получить данные как изображение.

Есть идеи?

// Open connection
    HttpURLConnection connection = (HttpURLConnection) url.openConnection();

    // Disable cache
    connection.setUseCaches(false);

    // Set the timeouts
    connection.setConnectTimeout(TIMEOUT);
    connection.setReadTimeout(TIMEOUT);

    // Connect to the MMSC
    ensureRouteToHost(context, urlMms, apnSettings);
    Log.d(TAG, "[MMS Receiver] Connecting to MMS Url " + urlMms);
    connection.connect();

    try
    {
        Log.d(TAG, "[MMS Receiver] Response code is " + connection.getResponseCode());

        if (connection.getContentLength() >= 0)
        {
            Log.d(TAG, "[MMS Receiver] Download MMS data (Size: " + connection.getContentLength() + ")");
            byte[] responseArray = new byte[connection.getContentLength()];
            DataInputStream i = new DataInputStream(connection.getInputStream());
            int b = 0;
            int index = 0;
            while ((b = i.read()) != -1)
            {
                responseArray[index] = (byte) b;
                index++;
            }
            i.close();

0 ответов

Другие вопросы по тегам