2013-08-18 6 views
0

나는 간단한 안드로이드 파일 관리자에서 일하고있다. 내가 직면 한 문제는 누군가가 파일 등을 보내려고 할 때 내 앱이 다른 앱이나 사이트에 파일을 업로드하도록하는 것입니다. 개발자 문서를 읽으려고했지만 조금 혼란 스러웠습니다. 이것을 처리하고 파일 업로드를 허용하기 위해 MainActivity를 설정하는 방법은 무엇입니까? 다음은 내 매니페스트에있는 것입니다.다른 앱 및 사이트로 파일 업로드를 처리하려면 어떻게해야합니까? 안드로이드

<activity android:name="com.myapp.MainActivity" android:label="@string/app_name" 
        android:configChanges="keyboardHidden|screenSize|orientation"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN"/> 
       <category android:name="android.intent.category.LAUNCHER"/> 
      </intent-filter> 
      <intent-filter> 
       <action android:name="android.intent.action.GET_CONTENT"/> 
       <category android:name="android.intent.category.OPENABLE"/> 
       <category android:name="android.intent.category.DEFAULT"/> 
       <data android:mimeType="*/*"/> 
      </intent-filter> 
      <intent-filter> 
       <action android:name="android.intent.action.PICK"/> 
       <category android:name="android.intent.category.DEFAULT"/> 
       <category android:name="android.intent.category.BROWSABLE"/> 
       <data android:scheme="file"/> 
       <data android:scheme="folder"/> 
       <data android:scheme="directory"/> 
      </intent-filter> 
      <meta-data android:name="android.app.searchable" 
         android:resource="@xml/searchable"/> 
     </activity> 

답변

0

매니페스트 파일에는 아무 것도 필요하지 않습니다. Android의 공유 의도를 사용하여 기기의 다른 애플리케이션과 콘텐츠를 공유합니다. http://developer.android.com/training/sharing/send.html

예 :하지만 다른

Intent shareIntent = new Intent(); 
shareIntent.setAction(Intent.ACTION_SEND); 
shareIntent.putExtra(Intent.EXTRA_STREAM, uriToImage); 
shareIntent.setType("image/jpeg"); 
startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.send_to))); 
+0

여기에 문서입니다. 내가 성취하려는 것은 예를 들어 Gmail 응용 프로그램을 열고 전자 메일을 작성할 때 파일을 첨부 할 수있는 옵션이 있고 선택하면 응용 프로그램 선택기가 열리는 것입니다. 나는 거기에 내 애플 리케이션을 얻을 수 있었지만, 나는 의도를 처리에 대해 어떻게 가야할지 모르겠다. – user2659645