I have pictures saved as files. Then I try to share them.
It works well on all messenger apps but doesn't work with Google drive. I have a notification error from Google drive.
First of all, after choosing Google drive in the share popup I can choose Folder. That means that Google drive see my files (or maybe only names?).
After that I immediately have error notification from Google drive, saying "Upload error, Cannot plan upload of 2 files" (or another count of files I've chosen).
Intent creation method:
@NotNull
private Intent initIntent() {
Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
intent.setType("image/jpg");
intent.putExtra(Intent.EXTRA_SUBJECT, "Pictures");
intent.putExtra(Intent.EXTRA_TEXT, "Pictures share");
return intent;
}
Tried sending one (with ACTION_SEND_MULTIPLE or with ACTION_SEND), tried adding different EXTRA_SUBJECT, EXTRA_TEXT, EXTRA_MAIL, adding EXTRA_TEXT as ArrayList (with intent.putCharSequenceArrayListExtra). Tried adding different flags to intent as intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK). Nothing helped.
Pictures extra for intent method:
private void addPicturesExtra(Intent intent) {
ArrayList<Uri> uris = new ArrayList<>(pictures.size());
for (PicturePresentation picture : pictures) {
File picFile = new File(picture.getPath());
Uri uri = Uri.fromFile(picFile);
uris.add(uri);
}
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
}
As I said before, tried with one Uri (picture file path) and with both ArrayList as an argument for intent extra and one Uri object.
Intent start method:
private void startIntent(Intent intent) {
try {
activity.startActivity(Intent.createChooser(intent, "Send"));
} catch (Exception ex) {
ExceptionHandler.handle(ex);
}
}
Tried starting it with or without chooser. It didn't help. Very strange that it works with all other apps but not with Google drive.
Below you can find the stack trace of Logcat when try to upload pictures to Google drive.
2020-10-15 15:47:49.871 V/FA: Activity resumed, time: 1113377792
2020-10-15 15:47:49.890 V/FA: Connecting to remote service
2020-10-15 15:47:49.899 D/FA: Connected to remote service
2020-10-15 15:47:49.900 V/FA: Processing queued up service tasks: 1
2020-10-15 15:47:54.904 V/FA: Inactivity, disconnecting from the service
2020-10-15 15:47:54.905 W/ConnectionTracker: Exception thrown while unbinding
java.lang.IllegalArgumentException: Service not registered: com.google.android.gms.measurement.internal.zzji@6e14ca2
at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1759)
at android.app.ContextImpl.unbindService(ContextImpl.java:1786)
at android.content.ContextWrapper.unbindService(ContextWrapper.java:751)
at com.google.android.gms.common.stats.ConnectionTracker.zza(com.google.android.gms:play-services-basement@@17.3.0:55)
at com.google.android.gms.common.stats.ConnectionTracker.unbindService(com.google.android.gms:play-services-basement@@17.3.0:50)
at com.google.android.gms.measurement.internal.zzio.zzag(com.google.android.gms:play-services-measurement-impl@@17.6.0:245)
at com.google.android.gms.measurement.internal.zzio.zzal(com.google.android.gms:play-services-measurement-impl@@17.6.0:262)
at com.google.android.gms.measurement.internal.zzio.zzc(com.google.android.gms:play-services-measurement-impl@@17.6.0:336)
at com.google.android.gms.measurement.internal.zzir.zza(com.google.android.gms:play-services-measurement-impl@@17.6.0:2)
at com.google.android.gms.measurement.internal.zzai.run(com.google.android.gms:play-services-measurement-impl@@17.6.0:7)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.google.android.gms.measurement.internal.zzfs.run(com.google.android.gms:play-services-measurement-impl@@17.6.0:21)
The only exception I have there is IllegalArgumentException which I think comes from GoogleAnalytics. Anyway, I think it has nothing with the problem I'm facing. (I have it in some other situations too)
Am I missing something obvious or is it just Google drive's bug? Would appreciate any kind of help!