floatinghotpot / cordova-plugin-sms

Plugin to operate SMS, send / list / intercept / delete / restore
172 stars 144 forks source link

'onSMSArrive' working only for different message arrival but not for same #65

Open BJSingh opened 7 years ago

BJSingh commented 7 years ago

My Device : Redmi Prime 3s (android 6.0.1)

when I send SMS with different value in message the onSMSArrive event triggered properly. But when I send new SMS with same value in repetition then onSMSArrive triggered only once and not for other successive messages. After this if I send SMS with different value then again it triggers.

ThorvaldAagaard commented 6 years ago

It seems that is by intent as

onSMSArrive(JSONObject json)

contains

        if (from.equals(this.lastFrom) && content.equals(this.lastContent)) {
            return;
        }
dilankamr commented 6 years ago

Hi All,

Did anyone find a solution for this issue?

ThorvaldAagaard commented 6 years ago

I think it is ok. I just added current timestamp as part of the message for my communication. Otherwise you can remove the above code in the JS-file

dilankamr commented 6 years ago

My app receives consecutive duplicate messages and I need to detect it. So I cant do your first suggestion. But removing code segment is pretty good. Thank you for your suggestions. But I can't find any code like that you mentioned. Could you please mention the file name that I have to do changes. Thanks

ThorvaldAagaard commented 6 years ago

Line 327 in https://github.com/floatinghotpot/cordova-plugin-sms/blob/master/src/android/SMSPlugin.java