Skip to content
This repository was archived by the owner on Feb 11, 2026. It is now read-only.

Commit 5d88d63

Browse files
committed
Add a hack to allow sharing files on newer android versions
Maybe fixes #46. It might not since it had no traceback.
1 parent 7bc26d9 commit 5d88d63

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

android/src/dev/lonami/klooni/AndroidLauncher.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,31 @@
1717
*/
1818
package dev.lonami.klooni;
1919

20+
import android.os.Build;
2021
import android.os.Bundle;
22+
import android.os.StrictMode;
2123

2224
import com.badlogic.gdx.backends.android.AndroidApplication;
2325
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
2426

27+
import java.lang.reflect.Method;
28+
2529
public class AndroidLauncher extends AndroidApplication {
2630
@Override
2731
protected void onCreate(Bundle savedInstanceState) {
2832
super.onCreate(savedInstanceState);
33+
34+
// FIXME: Hack to allow us use the old way to share files
35+
// https://stackoverflow.com/a/42437379/
36+
if (Build.VERSION.SDK_INT >= 24) {
37+
try {
38+
Method m = StrictMode.class.getMethod("disableDeathOnFileUriExposure");
39+
m.invoke(null);
40+
} catch (Exception e) {
41+
e.printStackTrace();
42+
}
43+
}
44+
2945
final AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
3046
final AndroidShareChallenge shareChallenge = new AndroidShareChallenge(this);
3147
initialize(new Klooni(shareChallenge), config);

0 commit comments

Comments
 (0)