mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 09:01:57 -05:00
Reduce target SDK version from 26 to 23 so I can use file:// uris when sharing screenshots to other applications. >= 24 throws a android.os.FileUriExposedException when I try that.
If this causes problems in the future, I made a properly working ContentProvider implementation for screenshots in AndroidContentProvider branch. I tested and it does seem to work, although it's terribly written code and probably breaks somehow. Definitely not worth the two hours I wasted on that and FileProvider.
This commit is contained in:
parent
a466890ac3
commit
982d0bb925
3 changed files with 7 additions and 8 deletions
|
@ -1,12 +1,12 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 26
|
||||
compileSdkVersion 23
|
||||
|
||||
defaultConfig {
|
||||
applicationId = 'com.classicube.android'
|
||||
minSdkVersion 13
|
||||
targetSdkVersion 26
|
||||
targetSdkVersion 23
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments '-DANDROID_STL=c++_static'
|
||||
|
|
|
@ -468,11 +468,10 @@ public class MainActivity extends Activity implements SurfaceHolder.Callback2 {
|
|||
|
||||
public String shareScreenshot(String path) {
|
||||
try {
|
||||
File file = new File(getExternalAppDir() + path);
|
||||
File file = new File(getExternalAppDir() + "/screenshots/" + path);
|
||||
Intent intent = new Intent();
|
||||
|
||||
intent.setAction(Intent.ACTION_SEND);
|
||||
intent.putExtra(Intent.EXTRA_TEXT, "Check out my app.");
|
||||
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
|
||||
intent.setType("image/png");
|
||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
|
|
|
@ -571,12 +571,12 @@ void Game_TakeScreenshot(void) {
|
|||
Chat_Add1("&eTaken screenshot as: %s", &filename);
|
||||
|
||||
#ifdef CC_BUILD_ANDROID
|
||||
filename.length = 0;
|
||||
JavaCall_String_String("shareScreenshot", &path, &filename);
|
||||
if (!filename.length) return;
|
||||
path.length = 0;
|
||||
JavaCall_String_String("shareScreenshot", &filename, &path);
|
||||
if (!path.length) return;
|
||||
|
||||
Chat_AddRaw("&cError sharing screenshot");
|
||||
Chat_Add1(" &c%s", &filename);
|
||||
Chat_Add1(" &c%s", &path);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue