mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-06-05 21:49:48 +02:00
Fix sharing log files on newer android versions
This commit is contained in:
@@ -57,6 +57,7 @@ import android.widget.Toast;
|
|||||||
import androidx.core.app.NavUtils;
|
import androidx.core.app.NavUtils;
|
||||||
import androidx.core.app.NotificationCompat;
|
import androidx.core.app.NotificationCompat;
|
||||||
import androidx.core.app.RemoteInput;
|
import androidx.core.app.RemoteInput;
|
||||||
|
import androidx.core.content.FileProvider;
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -681,10 +682,17 @@ public class DebugActivity extends AbstractGBActivity {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Uri providerUri = FileProvider.getUriForFile(
|
||||||
|
this,
|
||||||
|
getApplicationContext().getPackageName() + ".screenshot_provider",
|
||||||
|
logFile
|
||||||
|
);
|
||||||
|
|
||||||
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
|
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
|
||||||
|
emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
emailIntent.setType("*/*");
|
emailIntent.setType("*/*");
|
||||||
emailIntent.putExtra(EXTRA_SUBJECT, "Gadgetbridge log file");
|
emailIntent.putExtra(EXTRA_SUBJECT, "Gadgetbridge log file");
|
||||||
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(logFile));
|
emailIntent.putExtra(Intent.EXTRA_STREAM, providerUri);
|
||||||
startActivity(Intent.createChooser(emailIntent, "Share File"));
|
startActivity(Intent.createChooser(emailIntent, "Share File"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user