saravana
saravana

Reputation: 564

Unable to receive attached file in mail

I am developing an app which shares APK file. For that I have used Intent Chooser to display related/supported applications. In that if I select Gmail app now able to see attached file while composing & sent, but not received any attachment. But when I transfer via Bluetooth it is working fine. I don't know what is wrong with my code

My implementation like, sending Byte content from URI. Please help me out from this.

private void sendApk(String apkSourcePath2) {

     Intent sharingIntent = new Intent(Intent.ACTION_SEND);
    sharingIntent.setType("application/*");

    String shareBody = "Please find the attached APK file...";
    String subject = "From EasyShare";
    sharingIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
    sharingIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(apkSourcePath2)));
    sharingIntent.putExtra(Intent.EXTRA_TEXT, shareBody);
    startActivity(Intent.createChooser(sharingIntent, "Send/Share via.."));

}

Here apkSourcepath2 is pointing to Packageinfo.sourceDir

And also my question is, does Gmail cannot access file from data/app folder?

Any suggestions to implement this module????

Upvotes: 2

Views: 110

Answers (1)

Snicolas
Snicolas

Reputation: 38168

All depends on the value of apkSourcePath2.

If it is inside your app sandbox, it can't be accessed by any other app. You could use a content provider for this.

Upvotes: 3

Related Questions