2013-09-26 242 views

回答

2

它與SMS進來時有關係,它會觸發,然後再與基礎數據庫同步。我找到的最佳解決方案,實現一種忽略第二個呼叫的方式:

Long theDT = System.currentTimeMillis(); 
Long nextAM = Long.valueOf(1000); //Use a 1 second minimum delay to avoid repeated calls 
Long lastAM = preferences.getLong("lastAM", 0); 
if ((lastAM + nextAM) < theDT1){ 
    SharedPreferences.Editor editor = preferences.edit(); 
    editor.putLong("lastAM", theDT); // value to store 
    editor.commit(); 

    // DO WHAT YOU NEED TO DO HERE 
}