좋아, 나는 잠시 동안이 문제를 해결해 왔고, 나는 그것을 얻지 못하고있다. 여러 링크의 제안 사항 중 어느 것도 문제를 해결하지 못했습니다.이메일 의도를 사용하여
파일 전송을위한 응용 프로그램을 성공적으로 설정했습니다. 현재, 나는 그 파일을 내 응용 프로그램으로 여는 중 일하고있다.
받은 이메일의 파일을 클릭하면 내 활동이 열립니다.
내 응용 프로그램에서 사용하는 외부 저장소 폴더에 로컬로 파일을 저장해야합니다.
그래서 파일을 클릭하고 의도 필터가 올바른 활동을 열면 그 파일에 액세스하기 위해 다음에 무엇을합니까?
텐트 필터 :
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.gmgt" />
</intent-filter>
활동 : 파일을 전송하는 데 사용
public class ActFileReceiver extends Activity {
private TextView label;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_file_receiver);
label = (TextView) findViewById(R.id.lblFileRecieverText);
}
}
의도 : 당신은 ACTION_VIEW
을 지원하기 위해 찾고있는
public void emailFile(File file) {
Uri fileURI = Uri.fromFile(file);
Intent mailIntent = new Intent(android.content.Intent.ACTION_SEND);
mailIntent.setType("messsage/vnd.com.boardmonkey.TABLETop.gamefile");
mailIntent.putExtra(Intent.EXTRA_SUBJECT, "TABLETop game file: " + file.getName());
mailIntent.putExtra(Intent.EXTRA_STREAM, fileURI);
startActivity(Intent.createChooser(mailIntent, "Send Mail With..."));
}
"나는 코드 샘플이 없습니다."- 물론 그렇게합니다. 질문에 따라 활동이 있고''가 있습니다.'가 무엇을 위해서 ('ACTION_VIEW'?'ACTION_SEND'?) 다른 무엇을 할 것인가에 대한 세부 사항은 다양합니다. 그러니 적어도 우리에게 그것을주십시오. –
CommonsWare
충분히 공정하고, 그렇게 깊은, 내 잘못 생각하지 않았습니다. 내가 실제로하는 것을 반영하도록 편집 됨. –
action_sendto가 정상적으로 작동하면 내 응용 프로그램이 장치에서 보낼 수있는 응용 프로그램을 통해 파일을 성공적으로 보냅니다. –