- Home /
Use SAF in Unity AR Application without losing tracking
Recently, I've been using this plugin for picking files from storage for one of my AR Project. The following plugin is using the Storage Access Framework (SAF) for picking and saving files.
When I'm trying to use this in AR Scene (After Plane Detection), it lost its track after selecting/canceling from File Picker Interface.
I tried to call this plugin from UI Thread, but same as before. I've tried this code for calling from UI Thread -
new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity").Call("runOnUiThread", new AndroidJavaRunnable(() =>
{
AJC.CallStatic("PickFiles", Context, new FPResultCallbackAndroid(callback, null, null), false, SelectedFilePath, allowedFileTypes, "");
}));
Then,
I mailed the author of this plugin, he told me to add new flags to his source code and rebuild. I tried rebuilding adding FLAG_ACTIVITY_SINGLE_TOP
flag to intent, but same as before. (I've quite little experience in Native Android Development, so I just google a bit and tried this).
I'm not sure if there is any proper way or is it possible to use SAF without putting Unity Application in the Background. Is there any solution to this problem?
Your answer
![](https://koobas.hobune.stream/wayback/20220613020312im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
NativePlugin c++ Android sample and self build pcl not loading,Native Plugins c++ "dll not found" 2 Answers
Heating Problem with Unity-Android App even in low FPS??!! 1 Answer
Extracting Dataset (AR) from OBB (Expansion Files) 1 Answer
Record a video in unity on mobile (Android, IOS) 1 Answer
Ideas on Transparent shader that can receive shadows and is not ignored by Post processing stack? 0 Answers