回答

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 
}