Add a hack to allow sharing files on newer android versions
Maybe fixes #46. It might not since it had no traceback.
This commit is contained in:
parent
7bc26d9a62
commit
5d88d63419
1 changed files with 16 additions and 0 deletions
|
@ -17,15 +17,31 @@
|
|||
*/
|
||||
package dev.lonami.klooni;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.StrictMode;
|
||||
|
||||
import com.badlogic.gdx.backends.android.AndroidApplication;
|
||||
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class AndroidLauncher extends AndroidApplication {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// FIXME: Hack to allow us use the old way to share files
|
||||
// https://stackoverflow.com/a/42437379/
|
||||
if (Build.VERSION.SDK_INT >= 24) {
|
||||
try {
|
||||
Method m = StrictMode.class.getMethod("disableDeathOnFileUriExposure");
|
||||
m.invoke(null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
final AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
|
||||
final AndroidShareChallenge shareChallenge = new AndroidShareChallenge(this);
|
||||
initialize(new Klooni(shareChallenge), config);
|
||||
|
|
Loading…
Reference in a new issue