SMS Send is not working

#1

Below is my Package.json file

{
  "name": "EKMMobileApplication",
  "version": "0.1.1",
  "private": true,
  "devDependencies": {
    "@expo/vector-icons": "6.2.1",
    "babel-eslint": "7.2.3",
    "babel-jest": "19.0.0",
    "babel-preset-expo": "4.0.0",
    "babel-preset-react-native": "1.9.1",
    "eslint": "3.19.0",
    "eslint-plugin-react": "6.10.3",
    "eslint-plugin-react-native": "2.3.2",
    "jest": "19.0.2",
    "react-native-scripts": "0.0.50",
    "react-test-renderer": "16.0.0-alpha.6"
  },
  "main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
  "rnpm": {
    "assets": [
      "./assets/fonts"
    ]
  },
  "scripts": {
    "start": "react-native-scripts start",
    "eject": "react-native-scripts eject",
    "android": "react-native-scripts android",
    "ios": "react-native-scripts ios",
    "test": "node node_modules/jest/bin/jest.js --watch"
  },
  "jest": {
    "preset": "react-native"
  },
  "dependencies": {
    "@types/htmlparser2": "^3.7.31",
    "AsyncStorage": "^0.1.5",
    "axios": "0.16.1",
    "babel-plugin-native-base-theme-require": "0.0.1",
    "expo": "^27.0.0",
    "expo-analytics": "^1.0.7",
    "expo-jwt": "^1.1.0",
    "exponent": "14.0.0",
    "group-array": "^0.3.3",
    "i18next": "10.3.0",
    "jwt-decode": "^2.2.0",
    "lodash": "^4.17.11",
    "moment": "^2.22.2",
    "native-base": "^2.8.1",
    "react": "16.3.1",
    "react-i18next": "7.3.1",
    "react-moment": "^0.8.3",
    "react-native": "https://github.com/expo/react-native/archive/sdk-27.0.2.tar.gz",
    "react-native-action-button": "^2.8.5",
    "react-native-autolink": "^1.4.0",
    "react-native-calendar": "^0.13.1",
    "react-native-collapsible": "^0.13.0",
    "react-native-countdown-component": "^1.7.2",
    "react-native-datepicker": "^1.7.2",
    "react-native-device-detection": "^0.2.0",
    "react-native-dialog-input": "^1.0.4",
    "react-native-fbsdk": "0.6.1",
    "react-native-flash-message": "^0.1.10",
    "react-native-floating-action": "^1.13.0",
    "react-native-html-webview": "0.0.17",
    "react-native-i18n": "1.0.0",
    "react-native-icon-badge": "^1.1.3",
    "react-native-keyboard-aware-scroll-view": "^0.8.0",
    "react-native-loading-spinner-overlay": "^0.5.2",
    "react-native-material-dropdown": "^0.11.1",
    "react-native-modal-datetime-picker": "^6.0.0",
    "react-native-phone-call": "^1.0.9",
    "react-native-print": "^0.5.1",
    "react-native-render-html": "^3.10.0",
    "react-native-responsive-fontsize": "^0.1.2",
    "react-native-shadow": "^1.2.2",
    "react-native-simple-modal": "^9.0.1",
    "react-native-simple-radio-button": "^2.7.3",
    "react-native-slider": "^0.11.0",
    "react-native-swiper": "^1.5.14",
    "react-native-textarea": "^1.0.2",
    "react-native-textinput-effects": "^0.4.2",
    "react-native-ui-lib": "^3.12.0",
    "react-native-vector-icons": "4.1.1",
    "react-native-whc-loading": "^1.0.3",
    "react-navigation": "1.5.11",
    "react-redux": "5.0.6",
    "redux": "3.7.2",
    "redux-promise-middleware": "5.0.0",
    "save": "^2.3.2",
    "sentry-expo": "1.7.0",
    "tcomb-form-native": "^0.6.20",
    "toggle-switch-react-native": "^2.0.2"
  }
}

Below is my SMS sending code

const isAvailable = await Expo.SMS.isAvailableAsync();
      if (isAvailable) {
        alert('available for SMS send ');
        var phoneNumber = this.state.phoneNumber;
        var textMessage = this.state.smsText;

        const status = await SMS.sendSMSAsync(
          "9510349080",
          "HowDii...!!!"
        );
        console.log(status);
      } else {
        // error
      }

It gives me error as bellow:

[Unhandled promise rejection: TypeError: undefined is not an object (evaluating ‘_expo.Expo.SMS’)]

Stack trace:
src\components\EditCustomer\index.js:198:35 in _sendMessageToCustomer$
node_modules\regenerator-runtime\runtime.js:62:44 in tryCatch
node_modules\regenerator-runtime\runtime.js:296:30 in invoke
node_modules\regenerator-runtime\runtime.js:114:28 in
node_modules\regenerator-runtime\runtime.js:62:44 in tryCatch
node_modules\regenerator-runtime\runtime.js:152:28 in invoke
node_modules\regenerator-runtime\runtime.js:195:17 in
node_modules\promise\setimmediate\core.js:45:7 in tryCallTwo
node_modules\promise\setimmediate\core.js:200:23 in doResolve
node_modules\promise\setimmediate\core.js:66:12 in Promise
node_modules\regenerator-runtime\runtime.js:194:27 in callInvokeWithMethodAndArg
node_modules\regenerator-runtime\runtime.js:217:12 in enqueue
node_modules\regenerator-runtime\runtime.js:114:28 in
node_modules\regenerator-runtime\runtime.js:241:8 in async
null:null in _sendMessageToCustomer
node_modules\react-proxy\modules\createPrototypeProxy.js:44:35 in proxiedMethod
node_modules\react-native\Libraries\Components\Touchable\TouchableOpacity.js:201:45 in touchableHandlePress
node_modules\react-native\Libraries\Components\Touchable\TouchableOpacity.js:201:45 in touchableHandlePress
node_modules\react-native\Libraries\Components\Touchable\Touchable.js:744:34 in _performSideEffectsForTransition
node_modules\react-native\Libraries\Components\Touchable\Touchable.js:662:44 in _receiveSignal
node_modules\react-native\Libraries\Components\Touchable\Touchable.js:431:24 in touchableHandleResponderRelease
node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:39:15 in invokeGuardedCallback
node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:221:34 in invokeGuardedCallback
node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:245:48 in invokeGuardedCallbackAndCatchFirstError
node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:572:4 in executeDispatch
node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:603:20 in executeDispatchesInOrder
node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:761:29 in executeDispatchesAndRelease
node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:772:37 in executeDispatchesAndReleaseTopLevel
node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:740:16 in forEachAccumulated
node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:927:6 in runEventsInBatch
node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:952:19 in runExtractedEventsInBatch
node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:2703:6 in
node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:13724:16 in batchedUpdates
node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:2565:27 in batchedUpdates
node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:2701:17 in _receiveRootNodeIDEvent
node_modules\react-native\Libraries\Renderer\ReactNativeRenderer-dev.js:2777:28 in receiveTouches
node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:351:47 in __callFunction
node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:116:26 in
node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:314:6 in __guardSafe
node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:115:17 in callFunctionReturnFlushedQueue

Please help me if you can understand and have any solution regarding same issue:

#2

Hey @ipsekm,

The SMS API is not available in SDK27. It was introduced in SDK29 so you’ll have to upgrade to at least that to make use of it. I’d recommend upgrading to 31 or 32 if you can since we deprecate a version each time a new one is released. Doing so will give you more breathing room as well as benefit from the latest additions and performance/developer improvements.

Cheers,

Adam

#3

Thanks a Lot Adam for the proper reply.

closed #4

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.