2014-10-03 5 views
1

비밀 번호를 입력하면 서비스 응용 프로그램을 시작할 수 있습니다.비밀 번호로 서비스 시작 안드로이드

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="org..." 
    android:versionCode="1" 
    android:versionName="1.0" > 

    <uses-sdk 
     android:minSdkVersion="8" 
     android:targetSdkVersion="19" /> 

    <uses-permission android:name="android.permission.READ_PHONE_STATE" /> 
    <uses-permission android:name="android.permission.READ_CALL_LOG" /> 

    <application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" > 
     <activity 
      android:name=".MainActivity" 
      android:label="@string/app_name" > 
     </activity> 

     <receiver android:name=".IncomingCall" > 
      <intent-filter> 
       <action android:name="android.intent.action.PHONE_STATE" /> 
      </intent-filter> 
     </receiver> 

     <service 
      android:name="sniffingService" 
      android:label="androidCallProvider" > 
     </service> 

     <receiver android:name=".secretCodeApplicationStarter$onReceive" > 
      <intent-filter> 
       <action android:name="android.provider.Telephony.SECRET_CODE" /> 
       <data 
        android:scheme="android_secret_code" 
        android:host="9091"/> 
      </intent-filter> 
     </receiver> 
    </application> 

</manifest> 

이 내 방송 수신기입니다 :

import android.content.BroadcastReceiver; 
import android.content.Context; 
import android.content.Intent; 
import android.util.Log; 

public class secretCodeApplicationStarter extends BroadcastReceiver { 

    @Override 
    public void onReceive(Context context, Intent intent) { 
     if(intent.getAction().equals("android.provider.Telephony.SECRET_CODE")) { 
      Log.d("Helloo","Helloo"); 
      Intent i= new Intent(context, sniffingService.class); 
      context.startService(i); 
     } 
    } 

} 

이 내 서비스도 시작되지 않습니다 때문에 실행되지 않습니다

여기 내 매니페스트 파일입니다. 어떤 아이디어?

+0

android : scheme = "android_secret_code"는 예상되는 비밀 코드가 들어있는 변수입니까? 이것과 같이 "android_secret_code"를 기대하고 있습니다. 실제로 "android_secret_code"라는 문자열을 검색한다면 android : scheme = "@ string/android_secret_code"로 변경하십시오. –

+0

문자열 resurces android_secret_code = 9091에 추가 하시겠습니까? –

+0

이미 다른 것을 시작하는 비밀 코드를 찾으십시오. 예를 들어, Galaxy S4에서 * # 06 #은 MEID를 보여주는 것을 시작합니다. 작동하는 코드를 찾으면 동일한 코드로 코드를 설정하고 코드가 실행되는지 확인하십시오. 지금이 문제를 파악하려고합니다. 임의의 코드를 설정하면 S4에서 아무 일도 일어나지 않습니다. 기존 코드 (예 : 06)를 납치하면 작동합니다. 그 의미는 어딘가에 전화 걸기가 방송을 시작할 코드 목록이 있다는 것입니다. 이 목록은 어디에 있습니까? 그것에 추가 할 수 있습니까? 그것은 질문입니다. – JamieB

답변

1

수신자 선언에 android:name=".secretCodeApplicationStarter$onReceive" 대신 android:name=".secretCodeApplicationStarter"을 사용하십시오.

+0

나는이 dosnt 작업을 tryed! –

+0

코드를 테스트하기 전에 앱을 실행 했습니까? – cygery

+0

아니요이 코드로 앱을 시작하고 싶습니다. –

관련 문제