2012-09-10 2 views
0

나는 안드로이드 개발에 newbe 해요. 나는 자동 다운로더에 대한 응용 프로그램을 bulid내 개발 안드로이드 애플 리케이션의 DRM 파일을 다운로드

,

모든 다운로드가 제대로 작동하고 내 SD 카드, 에 저장하지만 DRM 파일은 장치에서 열 수 없습니다.

나는 내 자신을 설명하고 확장자가 dd \ dm 인 파일을 다운로드하려고 시도한다. 일반 브라우저에서 dd \ dm 파일을 다운로드하면 장치가 dcf 확장자로 압축을 풉니 다.

내 앱이 그렇게하지 않으면 ... 내 장치가 다시 시작하면 모든 것이 올바르게 표시됩니다. 실제로 장치가이 파일의 확장명을 dcf로 변경하고이 노래를 재생할 수 있습니다. 발신자가 아닐 경우 장치를 다시 시작 .dd.dm

MT 콘텐츠 형식의 파일 확장명 숙박입니다 : 응용 프로그램/vnd.oma.drm.message 내가 그 치료를 필요로하는지

누군가는 알고있다?

은 오래된 질문 비록

class DownloadFileFromURL extends AsyncTask<String, String, String> { 

    /** 
    * Before starting background thread 
    * Show Progress Bar Dialog 
    * */ 
    @Override 
    protected void onPreExecute() { 
     super.onPreExecute(); 
     showDialog(progress_bar_type); 
    } 

    /** 
    * Downloading file in background thread 
    * */ 
    @Override 
    protected String doInBackground(String... f_url) { 
     int count; 
     try { 

      URL url = new URL(f_url[0]); 
      URLConnection conection = url.openConnection(); 
      conection.getContent(); 
      conection.connect(); 
      // getting file length 
      int lenghtOfFile = conection.getContentLength(); 

      // Insert Information Of File to Array 
      getCurrentArray()[index].setSizeOfFile(OrangeFile.convertToStringRepresentation(lenghtOfFile)); 
      getCurrentArray()[index].setMimeOfFile(conection.getContentType()); 

      // input stream to read file - with 8k buffer 
      InputStream input = new BufferedInputStream(url.openStream(), 8192); 

      // Output stream to write file 
      OutputStream output = new FileOutputStream(mPath + getCurrentArray()[index].getNameOfFile() + "." + getCurrentArray()[index].getExtOfFile()); 


      byte data[] = new byte[1024]; 

      long total = 0; 

      while ((count = input.read(data)) != -1) { 
       total += count; 
       // publishing the progress.... 
       // After this onProgressUpdate will be called 
       publishProgress(""+(int)((total*100)/lenghtOfFile)); 

       // writing data to file 
       output.write(data, 0, count); 
      } 

      // flushing output 
      output.flush(); 

      // closing streams 
      output.close(); 
      input.close(); 


     } catch (Exception e) { 
      Log.e("Error: ", e.getMessage()); 
     } 

     return null; 
    } 

답변

0

, 당신은 이미 이것에 대한 어떤 대답을 가지고 있는지 확실하지 않습니다 ..... 내 코드입니다. 다음은이 문제를 극복하는 방법입니다.

먼저 파일 연결 API를 통해 ".dm"& ".dd"파일을 다운로드 할 수는 없지만 성공적으로 다운로드 할 수는 있지만 직접 사용할 수는 없습니다.

http://www.developer.nokia.com/Community/Wiki/Saving_and_reading_DRM-protected_files_using_FileConnection_API_and_Mobile_Media_API

".dm"파일로 변환 확인 ".dcf"장치의 OS로 SD 카드의 철저한 메모리 검사 이 때 자동으로. SD 카드를 마운트 해제하고 다시 마운트하면 장치를 다시 시작하지 않고도 파일이 변환됩니다.

그래서 장치를 다시 시작하지 않고 즉시 사용할 수 있도록 이러한 파일을 실제로 다운로드하는 방법.

위 링크에서 설명한 것처럼 HTTP (브라우저) 또는 MMS를 통해서만 보호 된 콘텐츠를 다운로드 할 수 있습니다.

서버에서 ".dm"파일을 가리키는 URL로 인 텐트를 생성하고 실행하십시오. 브라우저는 다운로드가 완료 되 자마자 url을 잡아 파일을 다운로드하고 ".dcf"로 자동 변환합니다.

희망이 도움이됩니다.

편집 : 파일 연결 API를 통해 파일을 다운로드 한 후 명시 적으로 미디어 스캐너를 호출 할 수 있습니다. "ACTION_MEDIA_SCANNER_SCAN_FILE"작업으로 인 텐트를 만들고 브로드 캐스트를 보냅니다.

관련 문제