Skip to content

Unable to get success callback even i sent the message successfully. #95

Description

@chetan-sharma-newput

I am not getting the success callback even I sent the SMS to the selected recipient. Every time I am getting a canceled callback.

Here's my code --

	requestSMSPermission = async () => {
		if (Platform.OS === 'android') {
			try {
				const granted = await PermissionsAndroid.request(
					PermissionsAndroid.PERMISSIONS.READ_SMS,
					{
						title: 'Sms Permission',
						message: 'App needs Sms permission',
					},
				);

				return granted === PermissionsAndroid.RESULTS.GRANTED;
			} catch (err) {
				console.log(err);
				return false;
			}
		} else return true;
	};

sendSMS = async (selectedContacts) => {
	
		let permission = await this.requestSMSPermission()
	
		if (permission) {
			SendSMS.send(
				{
					body: "Hello I am using App",
					recipients: selectedContacts,
					successTypes: ['sent', 'queued', 'failed', 'outbox'],
				},
				(completed, cancelled, error) => {
					if (completed) {
						console.log('SMS Sent Completed');
					} else if (cancelled) {
						console.log('SMS Sent Cancelled');
					} else if (error) {
						console.log('Some error occured');
					}
				},
			);
		}
	}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions