我想啓動我的服務應用程序進入祕密代碼調用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);
}
}
}
這是從來沒有執行,所以我的服務永遠不會開始了。有任何想法嗎 ?
是android:scheme =「android_secret_code」包含預期密碼的變量嗎?像這樣,它期待「android_secret_code」,如果你真的搜索名爲「android_secret_code」的字符串,請將其更改爲android:scheme =「@ string/android_secret_code」。 – 2014-10-03 13:55:59
你想添加字符串resurces android_secret_code = 9091? – 2014-10-03 14:10:46
找到一個已經可以啓動別的東西的密碼。例如,在Galaxy S4上,*#06#啓動了一個顯示您MEID的東西。一旦找到可用的代碼,請嘗試將您的代碼設置爲相同的代碼並查看它是否啓動。 這是我現在試圖弄清楚這個問題的地方。如果我設置了一個任意代碼,S4上沒有任何反應。如果我劫持現有的代碼(如06),它就可以工作。其含義是某處有一個撥號程序將啓動廣播的代碼列表。這個清單在哪裏?它可以添加到?就是那個問題。 – JamieB 2014-10-10 19:57:45