PhoneGapSMS demo server problem


#1

Other demo PhoneGap projects seem to work OK, but PhoneGapSMS demo has this error:

image


#2

I believe the author of that plugin recently bumped the version number to 1.0.0 - check the git repository and then check npm to make sure its also updated.


#3

Thanks a lot for your reply. I wasn’t able to find that version, but did manage to locate this one:

With this plugin, I can send an SMS perfectly, using this syntax:

SMS.sendSMS(inpNumber.value, txtMessage.value, function(){}, function(str){alert(str)});

However, I haven’t had any success in receiving an SMS (this plugin supports receiving and determining whether the SMS is intercepted or passed through).

This is a js example of the function:

document.addEventListener('onSMSArrive', function(e){
           	var sms = e.data
            	smsList.push( sms );
            	updateStatus('SMS arrived, count: ' + smsList.length );
         	
            	// sms.address
            	// sms.body

            	var divdata = $('div#data');
          	divdata.html( divdata.html() + JSON.stringify( sms ) );
           	
            });

How can I implement that in AppStudio? Thanks again,
Allan


#4

Lookup the plugin on git, check the dates it was last worked on and check the open issues… I bet this is a well known issue.

The problem you’re up against is that iOS and Android no longer let you completely bypass the SMS app because too many developers were abusing the users device.

So while the message appears to be sending, it’s either not sending or it’s in the sms app and you can’t reach it.

Eddie Verbruggen (sp?) wrote a social media sharing app and it supports sms sending but not receiving. You can test with that and see what you get.


#5

When I said Eddie had written a social sharing app, I meant he’d written a plugin:


#6

Thanks again. I managed to get both send and receive of an SMS working well with the aforementioned plugin. Here is the (very minimal, for simplicity) code for that:

//Send an SMS message using PhoneGap SMS plugin:
 // <plugin name="cordova-plugin-sms" source="npm" />

btnWatch.onclick = function() {

if(SMS) SMS.startWatch(function(){}, function(){});
if(SMS) SMS.enableIntercept(true, function(){}, function(){});

}

Button1.onclick = function() {

  SMS.sendSMS(inpNumber.value, txtMessage.value, function(){}, function(str){alert(str)});

};

document.addEventListener("onSMSArrive" , onSMSArrive);

function onSMSArrive(e) {
  IncomingSMS = e.data;
  recMessage.value = IncomingSMS.body;

}

The only thing that isn’t working (yet) is the Intercept function, and it could well be because of what you mentioned about the OS not allowing it anymore, because of the possibilities of abuse. That’s OK; that part is more of a “cosmetic” issue, and doesn’t affect the main goal of being able to have duplex communication via SMS.


#7

Now I have a much more serious problem. The new update doesn’t work. No forms appear, and I have to kill the task just to exit the application. Now what?


#8

I’m glad you got the SMS side working…

If you can’t resolve the new issue, open a separate topic for that.


#9

@allanroberts, Thanks for posting your code for the solution.

Could you edit your message and reformat the code a bit? Use a triple back tick (```) before and after the code. It will format properly.


#10

Done. I hope that it helps others with a similar requirement…


closed #11

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.