๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ’ปTech/๐ŸŒตandroid

[์•ˆ๋“œ๋กœ์ด๋“œ] LGํฐ ์†Œํ”„ํŠธํ‚ค ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๋ฐฉ๋ฒ•

by _viper_ 2015. 9. 15.
๋ฐ˜์‘ํ˜•

์•ˆ๋“œ๋กœ์ด๋“œ ๊ฐœ๋ฐœํ•  ๋•Œ Lgํฐ์— ์†Œํ”„ํŠธํ‚ค๋ฅผ ์œ ๋ฌด๋ฅผ ํ™•์ธํ•ด์•ผ ํ•  ๊ฒฝ์šฐ๊ฐ€ ์ข…์ข… ์žˆ๋Š”๋ฐ์š”.

๊ฐ„๋‹จํ•˜๊ฒŒ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์ด ์žˆ์Šต๋‹ˆ๋‹ค.

    /**
     * Lg ํฐ ์ผ ๊ฒฝ์šฐ Dp ๊ฐ’ ์กฐ์ •
     */
    private void checkLgPhone() {
        //๋ฉ”๋‰ด๋ฒ„ํŠผ ์œ ๋ฌด
        boolean hasMenuKey = ViewConfiguration.get(getApplicationContext()).hasPermanentMenuKey();
        //๋’ค๋กœ๊ฐ€๊ธฐ ๋ฒ„ํŠผ ์œ ๋ฌด
        boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);

        if (!hasMenuKey && !hasBackKey) { // lgํฐ ์†Œํ”„ํŠธํ‚ค์ผ ๊ฒฝ์šฐ
            Log.i("phoneType", "LGphone");

        } else { // ์‚ผ์„ฑํฐ ๋“ฑ.. ๋ฉ”๋‰ด ๋ฒ„ํŠผ, ๋’ค๋กœ๊ฐ€๊ธฐ ๋ฒ„ํŠผ ์กด์žฌ 
            Log.i("phoneType", "Not LGphone");
        }

    }

 if,else๋ฌธ์—์„œ ์ƒํ™ฉ์— ๋”ฐ๋ผ ์ฒ˜๋ฆฌ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.