How to add sender name in ionic-native/sms


#1

When I use this

for sending sms. In sender option my number is shown. Instead of my number i set another number with name.
How can i do this ?


#2

Hey, @Ayesha can you provide at least some of your code?


#3

yes. Here is my code

 <button ion-button round outline color="primary" (click)="signup()"  style=" margin: 0 auto; display:block"  >Sign Up</button> 

signup(){
// Send a text message using default options
this.smsVar.send(this.phone, ‘Hello world!’).then((res)=>
confirm(res)).catch((err)=>
confirm(err))
}


#4

Hey, @Ayesha
Here’s some code that I’ve just written it from here.

phoneNum: number;
textMsg: string;
constructor(private sms: SMS) { }

async sendTextMessage() {
  try {
    await this.sms.send(String(this.phoneNum), this.textMsg); 
    // Notify something to users.
  } catch (err) { // handle error here. }
}
<ion-item>
  <ion-label> Phone Number </ion-label>
  <ion-input [(ngModel)]="phoneNum" type="tel">
</ion-item>
<ion-item>
  <ion-label> Message </ion-label>
  <ion-input [(ngModel)]="textMsg" type="text">
</ion-item>
<button ion-button ion-left item-right (click)="sendTextMessage()"</button>

Hope this code helps, and please mark a solved button if this is what you want. So that other could get some help from this thread too.


#5

By using this code In sender option I get the number of phone in which app is installed. I want to set the sender number of mine not the app user phone number


#6

Do you want to test with some random numbers? Then probably you need to use some kind of API like Twilio to make it happen.


#7

I want to make a gmail app type verifciation while registering. The app user get the verification code while he will registering


#8

Do you use firebase?
Lack of given information doesn’t really help much. :frowning:


#9

no I don’t use firebase. I want to add the feature of verification sms in my app. For this purpose i found ionic sms plugin. I am a beginner and don’t have any idea how can i add this feature


#10

I strongly recommend using firebase. It reduces your development time.
I hope this link gives you some idea how to implement things as you wish.


#11

there is an error of hostname match not found occur