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

unable to read the otp from the message #4

Closed sonychoudhary closed 5 years ago

sonychoudhary commented 5 years ago

i have generated the hash string for my message and i m sending this message <#> Your One Time Password for RIDE is: 5901 mX1Za+RfF7a but unable to read otp its shows timeout after 5 min

hanatharesh2712 commented 5 years ago

@sonychoudhary How did you generate the hash of your APP? please see #3

sonychoudhary commented 5 years ago

i used this to generate the hash keytool -alias MyAndroidKey -exportcert -keystore MyProduction.keystore | xxd -p | tr -d "[:space:]" and the plugin u have mentioned is not working by which the hash code is generated Failed to fetch plugin https://github.com/hanatharesh2712/ionic-native-sms-retriever-plugin-master-hash.git via registry. the value for this
window['cordova']['plugins']['smsRetriever']['startWatching']( // the first callback is the success callback. We got back the native code’s result here. (result) => {

console.log('Message', result);
alert(result);
},

is undefined

hanatharesh2712 commented 5 years ago

@sonychoudhary have you tried with this command? ionic cordova plugin add https://github.com/hanatharesh2712/ionic-native-sms-retriever-plugin-master-hash.git

and follow these steps: 1) remove "cordova-plugin-sms-retriever-manager" plugin from your APP 2) Add plugin for to get hash as mentioned above. 3) you will get your APP hash in toast message. save it 4) remove hash plugin 5) Add the plugin using ionic cordova plugin add cordova-plugin-sms-retriever-manager@latest 6) send SMS with your hash code 7) you will receive SMS

hanatharesh2712 commented 5 years ago

try using remove android/ios platform and add it again.

ionic Cordova platform remove android/ios

ionic Cordova platform add android/ios

On Tue, Mar 12, 2019 at 11:01 PM sonychoudhary notifications@github.com wrote:

i have generated the hashcode and the app is reading the message but just as the message arrives the app crash giving some null error in log file 957 E AndroidRuntime: FATAL EXCEPTION: main 03-12 16:22:09.234 19957 19957 E AndroidRuntime: java.lang.RuntimeException: Unable to start receiver com.cordova.plugin.android.smsretriever.smsreceiverapi: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CallbackContext.success(java.lang.String)' on a null object reference 03-12 16:22:09.234 19957 19957 E AndroidRuntime: at android.app.ActivityThread.handleReceiver(ActivityThread.java:3413) 03-12 16:22:09.234 19957 19957 E AndroidRuntime: at android.app.ActivityThread.-wrap18(Unknown Source:0) 03-12 16:22:09.234 19957 19957 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1807) 03-12 16:22:09.234 19957 19957 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106) 03-12 16:22:09.234 19957 19957 E AndroidRuntime: at android.os.Looper.loop(Looper.java:164) 03-12 16:22:09.234 19957 19957 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7000) 03-12 16:22:09.234 19957 19957 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 03-12 16:22:09.234 19957 19957 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441) 03-12 16:22:09.234 19957 19957 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408) 03-12 16:22:09.234 19957 19957 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CallbackContext.success(java.lang.String)' on a null object reference 03-12 16:22:09.234 19957 19957 E AndroidRuntime: at com.cordova.plugin.android.smsretriever.smsreceiverapi.onReceive(smsreceiverapi.java:37) 03-12 16:22:09.234 19957 19957 E AndroidRuntime: at android.app.ActivityThread.handleReceiver(ActivityThread.java:3406) 03-12 16:22:09.234 19957 19957 E AndroidRuntime: ... 8 more

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hanatharesh2712/ionic-native-sms-retriever-plugin-master/issues/4#issuecomment-472102575, or mute the thread https://github.com/notifications/unsubscribe-auth/AQXI6y7dqFV6teQ6C8MO0uVkotVUBscaks5vV-RjgaJpZM4bqLp3 .

-- Regards, Haresh Hanat

hanatharesh2712 commented 5 years ago

@sonychoudhary Added a method(e.g. getAppHash) in the plugin to get APP hash code.