2014-10-03 65 views
1

我想启动我的服务应用程序进入秘密代码调用diler和它dosnt工作。启动服务与秘密代码android

这里是我的清单文件:

<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”。 – 2014-10-03 13:55:59

+0

你想添加字符串resurces android_secret_code = 9091? – 2014-10-03 14:10:46

+0

找到一个已经可以启动别的东西的密码。例如,在Galaxy S4上,*#06#启动了一个显示您MEID的东西。一旦找到可用的代码,请尝试将您的代码设置为相同的代码并查看它是否启动。 这是我现在试图弄清楚这个问题的地方。如果我设置了一个任意代码,S4上没有任何反应。如果我劫持现有的代码(如06),它就可以工作。其含义是某处有一个拨号程序将启动广播的代码列表。这个清单在哪里?它可以添加到?就是那个问题。 – JamieB 2014-10-10 19:57:45

回答

1

在您的接收器声明中使用android:name=".secretCodeApplicationStarter"而不是android:name=".secretCodeApplicationStarter$onReceive"

+0

我尝试了这个dosnt工作! – 2014-10-03 13:33:48

+0

您是否在测试代码之前启动您的应用程序? – cygery 2014-10-03 13:52:54

+0

不,我想用此代码启动应用程序 – 2014-10-03 14:13:46