hanatharesh2712 / ionic-native-sms-retriever-plugin-master

Cross-platform plugin for Cordova / PhoneGap to Retrieve SMS. Available for Android.
27 stars 18 forks source link

NullPointerException Println needs a message : Throwing Exception while reading messages #39

Closed mejainankit closed 1 year ago

mejainankit commented 1 year ago

It is throwing exception, while reading the message. If message doesn't have the hash. This plugin reads the message and sends a null message with status as success, which further throws an exception NullPointerException: Println needs a message at the following line.

Log.d(TAG, message);

 case CommonStatusCodes.SUCCESS:
              final String message = extra.getString(SmsRetriever.EXTRA_SMS_MESSAGE);
              //if (!StringUtils.hasContent(message)) return;

             Log.d(TAG, message);

              data = new JSONObject();
              try {
                data.put("Message",message);
              } catch(JSONException e) {}

              //Toast.makeText(cordova.getActivity().getApplicationContext(),"Message: "+ message, Toast.LENGTH_LONG).show();
              PluginResult result = new PluginResult(PluginResult.Status.OK, data);
              callbackContext.sendPluginResult(result);

              break;
mejainankit commented 1 year ago

@hanatharesh2712 Here is the PR for the same https://github.com/hanatharesh2712/ionic-native-sms-retriever-plugin-master/pull/40

hanatharesh2712 commented 1 year ago

@mejainankit Latest npm package(1.0.4) is available now. Thanks!