0
我有一個phonestatelistener: 我該如何在這裏開始服務? 我想:PhoneStateListener和服務
startService(new Intent(this, TTS.class));
它doent怎麼過的,我
private PhoneStateListener mPhoneListener = new PhoneStateListener() {
@SuppressLint("SdCardPath")
public void onCallStateChanged(int state, String incomingNumber) {
try {
switch (state) {
case TelephonyManager.CALL_STATE_RINGING:
//i want to start service
startService(new Intent(this, TTS.class));
錯誤是什麼? – njzk2
鎖在此:http://stackoverflow.com/questions/9361117/how-to-start-phonestatelistener-programmatically – Pasha
我得到這個錯誤,當我寫我上面寫的行:「構造函數Intent(new PhoneStateListener() {},Class)未定義,@ Pasha,我不明白你的鏈接我應該怎麼做才能啓動服務? –