user2895164
user2895164

Reputation: 49

Android Intent Share File not found

Hello I'm trying to share a file, but when uploading to DropBox or GoogleDrive etc. .. I get a message that the file is not found. Thanks for the help

invia.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
        shareIt();
        }

        private Intent shareIt() {

            Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
            shareIntent.setType("*/*");
            shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
            Uri uri = Uri.parse("/data/data/"+getPackageName()+"/databases/Mydb.db");
            shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
            startActivity(Intent.createChooser(shareIntent, "Share via"));
            return shareIntent;
        }
     });
}

Upvotes: 0

Views: 1135

Answers (1)

c0ming
c0ming

Reputation: 3543

The receiving application needs permission to access the data the Uri points to. There are two recommended ways from the Android Developer Site :Send Binary Content.

Upvotes: 1

Related Questions