Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
chetan-sharma-newput opened this issue Feb 24, 2021 · 3 comments

Comments

@chetan-sharma-newput
Copy link

chetan-sharma-newput commented Feb 24, 2021

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');
					}
				},
			);
		}
	}

@tkporter
Copy link
Owner

What device are you running this on?

@chetan-sharma-newput
Copy link
Author

What device are you running this on?

I was using Xiaomi A3 android device, Android 10 version.

@kpc0511
Copy link

kpc0511 commented Jul 1, 2021

Hi @tkporter, this issue is resolved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants