jmd2004
Posts: 1
Joined: Wed Jan 28, 2015 7:06 pm

SMS - WITH VARIABLE FROM LOCAL STORAGE

HI,

I'M TRYING TO CODE A BUTTON THAT WILL OPEN UP AN SMS WINDOW AND DYNAMICALLY POPULATE THE "BODY WITH A VARIABLE"

var my_id = localStorage.getItem("user_id");

window.open(‘sms:+375292771265?body= from Appery.io!’, ‘_system’);

Is this possible? If so, any help would be greatly appreciated! Thanks!

Egor Kotov6832188
Posts: 0
Joined: Wed Nov 19, 2014 5:15 pm

SMS - WITH VARIABLE FROM LOCAL STORAGE

Hello,

Try
var my_id = localStorage.getItem("user_id");
window.open(‘sms:+375292771265?body= TEST MESS BEGIN ’+my_id+' TEST MESS END', ‘_system’);

jmd2004
Posts: 1
Joined: Wed Jan 28, 2015 7:06 pm

SMS - WITH VARIABLE FROM LOCAL STORAGE

HI Egor,

Thanks for your quick reply. I found this info from the apple deveolpers website. So unfortunately, it doesn't appear to be possible on IOS. I will test on android.

The sms scheme is used to launch the Messages app. The format for URLs of this type is “sms:”, where is an optional parameter that specifies the target phone number of the SMS message. This parameter can contain the digits 0 through 9 and the plus (+), hyphen (-), and period (.) characters. The URL string must not include any message text or other information.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

SMS - WITH VARIABLE FROM LOCAL STORAGE

Hello jmd2004,

Thank you for the update.

She
Posts: 0
Joined: Wed Oct 08, 2014 12:46 am

SMS - WITH VARIABLE FROM LOCAL STORAGE

Hi i used the code that egor give. but the screen show below always show before the SMS compose show.:
.png?1430103988]Image

How can i move to SMS composition without showing this browser?

She
Posts: 0
Joined: Wed Oct 08, 2014 12:46 am

SMS - WITH VARIABLE FROM LOCAL STORAGE

i used following code:
code
var x = localStorage.getItem('Cnum');
if((x ==="null")){
Appery("popupAlert").popup('open');
}else if (x ===''){
Appery("popupAlert").popup('open');
}else{
window.open('sms:'+ x,'_status');
}
/code

and the browser showed before the sms composition :(

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

SMS - WITH VARIABLE FROM LOCAL STORAGE

Second parameter of window.open() should be '_system'

She
Posts: 0
Joined: Wed Oct 08, 2014 12:46 am

SMS - WITH VARIABLE FROM LOCAL STORAGE

Hi Sergiy,

Everytime i used the '_system' to the second parameter, there's an error and always show the "INVALID RECIPIENT".

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

SMS - WITH VARIABLE FROM LOCAL STORAGE

Could you specify what device and OS version you use to test?

Return to “Issues”