Help us understand the problem. What is going on with this article?

Unity上からAndroidのステータスバーをいじる メモ

More than 3 years have passed since last update.

■Unity上からAndroidのステータスバーをいじる

class StatusBarChanger {
    private static int newStatusBarValue;

    public static void Show() {
        #if UNITY_ANDROID
            setStatusBarValue(2048); // WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN
        #endif
    }

    public static void Hide() {
        #if UNITY_ANDROID
            setStatusBarValue(1024); // WindowManager.LayoutParams.FLAG_FULLSCREEN; change this to 0 if unsatisfied
        #endif
    }

    private static void setStatusBarValue(int value) {
        newStatusBarValue = value;
        using (var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) {
            using (var activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity")) {
                activity.Call("runOnUiThread", new AndroidJavaRunnable(setStatusBarValueInThread));
            }
        }
    }

    private static void setStatusBarValueInThread() {
        #if UNITY_ANDROID
        using (var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) {
            using (var activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity")) {
                using (var window = activity.Call<AndroidJavaObject>("getWindow")) {
                    window.Call("setFlags", newStatusBarValue, newStatusBarValue);
                }
            }
        }
        #endif
    }
}

■Androidネイティブプラグイン等の参考ページ

http://qiita.com/otmb/items/98a4472674a561d93900

http://qiita.com/Gazyu/items/68ef5f8e60500575932b

http://tasogare66.blog.fc2.com/blog-entry-66.html

http://wannabe-jellyfish.hatenablog.com/entry/2015/02/22/000923

http://wannabe-jellyfish.hatenablog.com/entry/2015/02/22/000923

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした