2017-10-05 49 views
-3

創建自定義廣播接收器以接收短信。寫邏輯中止boradcast這樣就不會提供給你的收件箱中的郵件在Android到達收件箱之前,在Android中刪除短信?

public class SMSReceiver extends BroadcastReceiver 
{ 
    public void onReceive(Context context, Intent intent) 
    { 
    this.abortBroadcast(); 
    } 
} 
<receiver android:name=".SMSReceiver"> 
     <intent-filter android:priority="1000"> 
      <action android:name="android.provider.Telephony.SMS_RECEIVED"/> 
     </intent-filter> 
    </receiver> 

不工作的任何建議... 仍然顯示通知和短信收件箱中達到

回答

3

他們取消這種能力的幾個版本前。只有用戶選擇的SMS應用程序才能刪除郵件或阻止他們打開收件箱。

+0

你可以分享任何示例,我如何停止默認短信通知。 –

+1

@SanaanChattha這意味着你的應用程序必須是默認的短信應用程序。您不能擁有不是默認短信應用程序的應用程序並刪除短信 – Zoe