GithubHelp home page GithubHelp logo

react-native-sms's People

Contributors

adrianzghibarta avatar ajmath avatar bennyhobart avatar bunea avatar fredrikp avatar gcoro avatar giautm avatar hhunaid avatar jehartzog avatar kfiroo avatar krbz avatar leogout avatar michaelrbond avatar miloszfilimowski avatar newxiaofeng avatar rodrigopivi avatar tkporter avatar tmaly1980 avatar wildseansy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

react-native-sms's Issues

NullPointerException on calling `SendSMSPackage.onActivityResult`

Our logs show that the most popular crash of our app is

Caused by java.lang.NullPointerException
Attempt to invoke virtual method 'void com.tkporter.sendsms.SendSMSModule.onActivityResult(android.app.Activity, int, int, android.content.Intent)' on a null object reference
  com.tkporter.sendsms.SendSMSPackage.onActivityResult (SendSMSPackage.java:49)

So, I understand that the sendSms in this line is null.

That's called from the app's MainActivity.java

public void onActivityResult(int requestCode, int resultCode, Intent data) {
  super.onActivityResult(requestCode, resultCode, data);
  SendSMSPackage.getInstance().onActivityResult(requestCode, resultCode, data);
  ...

Any idea on what's the problem?
Thanks in advance.

SendSMS.send got 4 arguments, expected 3

Hello,

When running in releaseMode on real Android devices (tested on HTC one, samsung galaxy s7, samsung galaxy s5) the app crashes at the moment we run SendSMS.send.

When connecting the device to the phone and running adb logcat gives a NativeArgumentsParseException: SendSMS.send got 4 arguments, expected 3 the full error looks like this :

.... AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
.... AndroidRuntime: Process: com.sp00t, PID: 1903
.... AndroidRuntime: com.facebook.react.bridge.NativeArgumentsParseException: SendSMS.send got 4 arguments, expected 3
.... AndroidRuntime: 	at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:318)
.... AndroidRuntime: 	at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:136)
.... AndroidRuntime: 	at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
.... AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:751)
.... AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:95)
.... AndroidRuntime: 	at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
.... AndroidRuntime: 	at android.os.Looper.loop(Looper.java:154)
.... AndroidRuntime: 	at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
.... AndroidRuntime: 	at java.lang.Thread.run(Thread.java:762)

The code sending the sms looks like this :

    Alert.alert(
      `${title}`,
      message,
      [
        {
          text: I18n.t('send'),
          style: 'cancel',
          onPress: () => {
            SendSMS.send({
              body: I18n.t('smsText'),
              recipients: smsList.map(contact => contact.phone),
              successTypes: ['sent', 'queued']
            }, (completed, cancelled, error) => {
              console.log(`SMS Callback: Completed: ${completed} Cancelled: ${cancelled} Error: ${error}`)
            })
          }
        },
        {
          text: I18n.t('cancel'),
          onPress: () => {
          }
        }
      ]
    )

Changing the API version does not seem to help (tested with 3 different android SDK version in the build.gradle.
Interestingly It works on the emulator

Android READ_SMS permissions clarification

Hey @tkporter, thanks for the great package :)
Just wondering why we need to request PermissionsAndroid.PERMISSIONS.READ_SMS permission?
Also, we don't currently use the M Permission model in our android app, is it possible to declare this permission in the manifest instead of requesting it on send?

MainApplication.java

New at this so apologies. In MainApplication.java is the following:


    protected List<ReactPackage> getPackages() {
      @SuppressWarnings("UnnecessaryLocalVariable")
      List<ReactPackage> packages = new PackageList(this).getPackages();
      // Packages that cannot be autolinked yet can be added manually here, for example:
      // packages.add(new MyReactNativePackage());
      return packages;
    }

but the readme shows:

protected List<ReactPackage> getPackages() {
    //some variables
 
    return Arrays.<ReactPackage>asList(
        //probably some items like `new BlahPackage(),`
        //just add into the list (don't forget commas!):
        SendSMSPackage.getInstance()
    );
}

Is there a way to get "SendSMSPackage.getInstance()" to work in there?

react-native-sms: Appears to be a git repo or submodule

I got following error when npm install

npm ERR! code EISGIT
npm ERR! path /home/ksbae/overclass/node_modules/react-native-sms
npm ERR! git /home/ksbae/overclass/node_modules/react-native-sms: Appears to be a git repo or submodule.
npm ERR! git     /home/ksbae/overclass/node_modules/react-native-sms
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ksbae/.npm/_logs/2020-01-10T06_30_28_458Z-debug.log

avishayil/react-native-restart#71 (comment)
It looks like .git is included in library deployment.

Fatal Exception: android.content.ActivityNotFoundException

@tkporter Hello again :D

Fatal Exception: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.SEND typ=text/plain...

It is quite rare but some Android devices do not have any apps which may consume android.intent.action.SEND. Need to add checking for it :)

Also small suggestion, please add TAG to Commit where you bump version number :)

Is there a particular reason why sending message in background is not supported?

In the readme, there is a section describing

Currently, only user-initiated sending of an SMS is supported. This means you can't use react-native-sms to send an SMS in the background-- this package displays the native SMS view (populated with any recipients/body you want), and gives a callback describing the status of the SMS (completed/cancelled/error). PRs are welcome!

Is there a particular reason for not doing it? I'm very new to this and thanks your time for answering!

Uses deprecated permission api

Getting the following warning when we use your library:

"PermissionsAndroid.requestPermission" is deprecated. Use "PermissionsAndroid.request" instead

I think it's how the permission is checked in index.js.

Multiple recipients don't display correctly in Android

Not sure if this is a problem with Android or the lib, but figured I'd bring this up.

If I create an SMS to two recipients in Android, my screen looks like this:

image

However if I create an SMS to two recipients via the lib, I get this:

image

Notice how only the last recipient is shown. This is what the "People & Options" menu looks like:

image

It appears that both numbers are being added (hence the block text) but that only the last is taken into account (hence the "people in this conversation" list). I'm not testing this on an actual device yet so I don't know if it's just a display issue or if the SMS will actually only be sent to the second recipient, but at the very least this could be confusing for the user from a UX standpoint.

Callback always return error = true even sms sent

Hi @tkporter

Thank you for your awesome package.
I'm able to integrate your package to my RN-app.
But I'm facing an issue while checking the callback function, it always return error = false.
I use same code as your example:

SendSMS.send({
     body: 'The default body of the SMS!',
     recipients: ['6285921010XXX'],
     successTypes: ['sent', 'queued'],
     allowAndroidSendWithoutReadPermission: true
}, (completed, cancelled, error) => {
     console.log('SMS Callback: \ncompleted: ' + completed + '\ncancelled: ' + cancelled + '\nerror: ' + error);
});

But I always got this:
image

How to fix this?
Need your advice.
Thanks before.

Version:
react-native; 0.57.7
react-native-sms: 1.9.0

Remove .git from package

It's not letting npm to install other packages after installing react-native-sms in the project

npm ERR! path /var/www/html/project-name/node_modules/react-native-sms
npm ERR! code EISGIT
npm ERR! git /var/www/html/project-name/node_modules/react-native-sms: Appears to be a git repo or submodule.
npm ERR! git /var/www/html/project-name/node_modules/react-native-sms
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/user-name/.npm/_logs/2020-01-15T14_29_55_570Z-debug.log

Production Build Error on Android

When build a production version the app I keep getting this error:

Execution failed for task ':react-native-sms:verifyReleaseResources'.

java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
  Output:  error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
 /Path-to-project/node_modules/react-native-sms/android/build/intermediates/res/merged/release/values-v26/values-v26.xml:7: error: resource android:attr/colorError not found.
   /Path-to-project/node_modules/react-native-sms/android/build/intermediates/res/merged/release/values-v26/values-v26.xml:11: error: resource android:attr/colorError not found.
   /Path-to-project/node_modules/react-native-sms/android/build/intermediates/res/merged/release/values-v26/values-v26.xml:15: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
   /Path-to-project/node_modules/react-native-sms/android/build/intermediates/res/merged/release/values/values.xml:226: error: resource android:attr/fontStyle not found.
   /Path-to-project/node_modules/react-native-sms/android/build/intermediates/res/merged/release/values/values.xml:226: error: resource android:attr/font not found.
  /Path-to-project/node_modules/react-native-sms/android/build/intermediates/res/merged/release/values/values.xml:226: error: resource android:attr/fontWeight not found.
  error: failed linking references.

and I cant just find any means to comprehend whats happening here. Can anyone help please when I remove this package everything seems to be working fine back

recipient add. duplicate or invalid contacts not added.

Hi.

i use this code:

SendSMS.send({
body: this.state.activateCode,
recipients: ["+44..."],
successTypes: ['sent', 'queued']
}, (completed, cancelled, error) => {
if (completed) {
} else {
}
});

and open default android sms manager!

i want to send in background.

How do I do this?

Thanks for help.

Merge pull request

Can someone merge the pull request?
Would be nice you have those pull request features/fixes.

Thanks, Adri

Send an sms in the background

Hi all,

Very nice package. I would like to ask you guys, if you know if there´s possible to send an SMS in the background, without going to the iMassage interface, so I can keep the user on my app, all the time. Thanks for your help.

how to correctly handle permission?

I've got this error:

Fatal Exception: java.lang.SecurityException: Permission Denial: reading com.android.providers.telephony.SmsProvider uri content://sms/ from pid=23329, uid=10322 requires android.permission.READ_SMS, or grantUriPermission()
       at android.os.Parcel.readException(Parcel.java:1620)
       at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
       at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
       at android.content.ContentProviderProxy.query(ContentProviderNative.java:421)
       at android.content.ContentResolver.query(ContentResolver.java:502)
       at android.content.ContentResolver.query(ContentResolver.java:445)
       at com.tkporter.sendsms.SendSMSObserver.onChange(SendSMSObserver.java:99)
       at android.database.ContentObserver.onChange(ContentObserver.java:130)
       at android.database.ContentObserver.onChange(ContentObserver.java:145)
       at android.database.ContentObserver$NotificationRunnable.run(ContentObserver.java:216)```

How should I handle this properly?

Can't get body to pre-fill

I'm noticing with your example:

    SendSMS.send({
      body: 'The default body of the SMS!',
      recipients: ['1234567890'],
      successTypes: ['sent', 'queued']
    }, (completed, cancelled, error) => {
      console.log('SMS Callback: completed: ' + completed + ', cancelled: ' + cancelled + ', error: ' + error)
    })

The body message doesn't get filled in at all. In fact, it happens to say MMS instead of SMS and there is a blank second recipient, ie there's a comma at the end of my only recipient, even though my recipients parameter looks like ["1234567890"]

I'm having this issue on Android (my actual phone with KitKat). I've used react-native-communications and that pre-fills the content, it just doesn't have a callback feature.

Issue on callback when trying to get the sms status

Hello there.
I'm trying to get the status of the sms using the function on your example ("someFunction") but as soon as the sms app opens it goes directly to cancelled. I would need to get a success status when the sms is sent. Is it possible? Thanks very much

possible linking issue on android side

I'm running into a hiccup on android, with the error below.

Cannot read property 'send' of undefined
TypeError: Cannot read property 'send' of undefined

points to the following section of the js bundle:

_reactNative.NativeModules.SendSMS.send(options,callback);case 10:case'end':return _context.stop();}}},null,this,[[1,7]]);}

I've re-installed this library and gone through the whole setup a couple of times now.

I'm running RN 38.1 on this project and have triple checked the android install instructions as well as the Troubleshooting section. Everything on the iOS side is fine. Thanks in advance for guidance!

[Android] Not being redirected back to app after sending an SMS

After successfully sending an sms, I'm currently not being automatically redirected to my app. For that, I have to push the back button. Surely this is something that should be built-in to this library, is it not?

If so, how to implement?

(I am testing on Samsung Galaxy S8)

Callback failure

I'm not getting any results from the callback OTHER than 'completed: false, cancelled: true, error: false", whether I press back during the message composition or I actually send the message.

Is there a way to know whether the text messages were actually sent or not? I'm needing both Android and iOS solutions, but it seems like I'm more than likely going to have to move away from SMS and toward push notifications if I want more robust/automated/failureproof peer-to-peer communication.

Compilation error

We are starting to get this error during daily builds:

/Users/buildadm/workspace/flare-one/flare/node_modules/react-native-sms/Android/src/main/java/com/tkporter/sendsms/SendSMSModule.java:34: error: method does not override or implement a method from a supertype
    @Override
    ^
/Users/buildadm/workspace/flare-one/flare/node_modules/react-native-sms/Android/src/main/java/com/tkporter/sendsms/SendSMSModule.java:43: error: method does not override or implement a method from a supertype
    @Override
    ^

resultCode is 0 (e.g. Activity.RESULT_CANCELED) when SMS message is successfully sent on Android

When I test on my Android device but when the SMS is sent then the resultCode is always 0 (e.g. Activity.RESULT_CANCELED). Any ideas why?

I log the resultCode in the onActivityResult method.

@Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
      if (resultCode == Activity.RESULT_CANCELED) {
        Log.i("APP", "SMS CANCELLED");
      }
      super.onActivityResult(requestCode, resultCode, data);
      SendSMSPackage.getInstance().onActivityResult(requestCode, resultCode, data);
    }

Default to MMS?

SendSMS.send({
      body: `Hi, ${smsBody}`,
      recipients: [''],
      successTypes: ['all']
    }, (completed, cancelled, error) => {
      console.log('SMS Callback: completed: ' + completed + ' cancelled: ' + cancelled + 'error: ' + error);
    });

First of all, as shown above, I wished to have a non-filled recipients but in the sms composer it will shows Buddy Name by default? And second issue is that instead of New Message, it's showing New MMS?

react-native upgrade deprecating rnpm

Upgrading react-native version to 0.60.5 is showing this warning regarding this library.

warn The following packages use deprecated "rnpm" config that will stop working from next release

Please fix this so that we continue to use your library with react-native upgrades :)

Android send sms without pointing recipient

Hello got some strange behaviour when trying to send sms via android without defining at least one phone number in "recipients" folder:
it provides android recipient choosing page and when i choose one - it opens sms window BUT without prefilled text defined in "body". How could i solve this problem?

Same code works fine on iOS. If predefine recipient - everything works fine as well.
Thanks for help.

Malformed calls from JS, field sizes are different.

Has anyone had this issue before? I'm literally using the same code as in the description.
SendSMS.send( { body: this.state.message, recipients: ['00432321312'], successTypes: ['sent', 'queued'], }, (completed, cancelled, error) => { this.props.navigation.navigate('Overview'); }, );

grafik

How can I complete sending SMS

Hello,

I have installed and configured this library on my Android phone, following the example in documentation when I invoke someFunction it composes a text message window that has the body and recipients, however it doesn't send the SMS message unless I press send.

How can I go about automating that? so that when I call someFunction it will send the text message without having to press send on Android text message app.

Thanks

Callback is not being executed after sending the sms successfully

It seems like there is no way to know when the sms is successfully sent, the callback is not being called after sending the SMS on android. but, if I do cancel the sms taping back, it gets into the callback. otherwise it does not know it. is there any delay or something when the sms has been sent?

SendSMS.send({

        body: 'The default body of the SMS!',
        recipients: ['0123456789', '9876543210'],
        successTypes: ['sent', 'queued'],
        allowAndroidSendWithoutReadPermission: true
    }, (completed, cancelled, error) => {
 
        console.log('SMS Callback: completed: ' + completed + ' cancelled: ' + cancelled + 'error: ' + error);
 
    });

SMS tray doesn't open on ios - flashes black for less then a second instead

I am successfully using this in one part of my ios app but it does not work in another spot. I call the send method and it flashes black for less then a second. It is not being blocked by another modal. There does not appear to be any errors in the xcode logs. Has anyone else experienced this issue?

Thanks!

body repeats

I've got the module working great, but no matter what body I put in (the default, blank spaces, the word TEST, etc), it always gets put in twice when pre-filling the message.

<Button title="Text" onPress={() => SendSMS.send({
                    body: 'TEST',
                    recipients: [this.props.number],
                    successTypes: ['sent', 'queued']
                }, (completed, cancelled, error) => {             
                    console.log('SMS Callback: completed: ' + completed + ' cancelled: ' + cancelled + 'error: ' + error);
                })} />

Will the app fail if we do not have the READ_SMS permission?

Hi there,

I previously wanted to use this library but it became problematic because of the 'READ_SMS' permission.

Is it possible to not include that permission at all and then use the allowAndroidSendWithoutReadPermission ?

Or does the app require this as a baseline and the allowAndroidSendWithoutReadPermission is only used to handle the case where the user denies the permission?

In callback function all parameters are false only on Android

Here is a piece of code:

SendSMS.send(
      {
        body: message,
        recipients: [phoneNumber],
        successTypes: ['all'],
        allowAndroidSendWithoutReadPermission: true,
      },

      (completed, cancelled, error) => {
        // If Message was sent successfully we have to disable button and update backend
        if (completed) {
          updateReminded({
            variables: {
              inviterAccountId: accountId,
              inviteeSeatId: invitedSeatId,
            },
          });
          setIsReminded(true);
        }
      }
    );

For any Android after sms send completed, cancelled and error are false

Google Declaration Form on SMS Restrictions

With Google's new restrictions on sms/call log permissions, how do you recommend filling out the permissions declaration form when submitting your new APK to use react-native-sms.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.