상세 컨텐츠

본문 제목

Android에서 Hidden menu 설정하기

개발/Android

by 대충고양이짤 2013. 7. 23. 13:21

본문

Hidden menu 란?

Android에서 Dial메뉴의 특정 키를 눌러 진입할 수 있는 숨겨진 메뉴입니다.


설정하는 방법
1.AndroidManifest.xml에서 아래와 같이 receiver를 등록합니다.

<receiver android:name="com.test.HiddenKeyReceiver">
 <intent-filter>
  <action android:name="android.provider.Telephony.SECRET_CODE" />
  <data android:scheme="android_secret_code" android:host="1234567890" />
 </intent-filter>
</receiver>
 


2.키스트링이 입력될 경우 수행될 HiddenKeyReceiver.java 파일을 생성합니다.

public static final String STRING_CODE= "android.provider.Telephony.SECRET_CODE";

@Override
public void onReceive(Context context, Intent intent)
{
  if (intent.getAction().equals(STRING_CODE))
  {
     Intent i = new Intent(Intent.ACTION_MAIN);
     String host = intent.getData().getHost();

     if ("1234567890".equals(host)) i.setClass(context, startActiviy.class);
  }
}
 

3.Dial 화면에서 아래와 같이 입력하면 startActiviy에 진입할 수 있습니다.
*#*#1234567890#*#*


'개발 > Android' 카테고리의 다른 글

[Android] INSTALL_FAILED_CONFLICTING_PROVIDER  (0) 2016.02.16

관련글 더보기

댓글 영역