This is an Android media scan question from Unity (c#).

Asked 2 years ago, Updated 2 years ago, 112 views

I don't see the files I downloaded from the gallery right after downloading the images or videos, so I think I need to scan the media No matter how much you search, most of them are Java, and since you search,

    #if UNITY_ANDROID
    public void RefreshGallery(string path)
    {
        AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity");
        AndroidJavaClass javaClass = new AndroidJavaClass("com.example.refresgallery.RefreshFromUnity");
        javaClass.CallStatic("RefreshGallery",jo,path);
    }
    #endif

This chord came out, but when I tried it, it didn't move.

I don't know how to make a plug-in yet, so please help meㅠ<

c# unity android media

2022-09-22 12:17

1 Answers

The code you posted is the code you use to use the plug-in.

Did you put the jar file containing the package "com.example.refresgallery.RefreshFromUnity" in the Assets->Plugins->Android folder?

In order to use the plug-in, you must first have a plug-in created.

Please refer to this video for the overall process.


2022-09-22 12:17

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.