import android.support.v4.app.ShareCompat;
Uri pdfUri = Uri.parse("file://sdcard/sdcard0/test.pdf");
Intent shareIntent = ShareCompat.IntentBuilder.from(this)
.setText("Share PDF doc")
.setType("application/pdf")
.setStream(pdfUri )
.getIntent()
.setPackage("com.google.android.apps.docs");
startActivity(shareIntent);
If you need to upload data from a Service instead of an Activity all you have to do is creating a "dummy activity", insert the above ShareCompat code in the onCreate() method and put finish() after the startActivity(shareIntent) command.
Other Intents can be targeted with similar code, changing the package name, e.g.
Other Intents can be targeted with similar code, changing the package name, e.g.
- com.dropbox.android = Dropbox
- com.android.bluetooth = Bluetooth
- com.android.email = Email
- com.google.android.gm = Gmail
- com.microsoft.skydrive = Skydrive
- com.google.android.apps.docs = Googledrive