rehy / cordova-plugin-sms-receiver

Cordova SMS Receiver Plugin
MIT License
17 stars 19 forks source link

Error while using this for IONIC app #6

Open BasuSharma opened 7 years ago

BasuSharma commented 7 years ago

Hi, I am getting error as - \SmsReceiverPlugin.java:8: error: package android.support.v4.app does not exist while building an ionic app just after installing this plugin and adding given code. Any help would be appreciated.

Thanks Basu

rosi92b commented 7 years ago

Hi, I'm getting the same error as yours. Thus I was wondering if you were able to solve it. Thanks.
Rosi

BasuSharma commented 7 years ago

Hey Rosi, I didn't get any solution to above error. But I found another plugin here, which works for me perfectly, so instead of waiting here for this issue to be resolved I used other plugin. ** Use smsrec.Method_Name() You can also give a shot to this. Hope it helps. Thanks Basu

rosi92b commented 7 years ago

I have another issue to ask you. In the 3rd step the github page of the plugin said: Add the java files from src to your project's src hierarchy. Well, I've extracted all the files where I have to paste exaclty the java files? Can you tell me the path in the ionic project? thanks a lot.

BasuSharma commented 7 years ago

Hi Rosi, Hope you are having a nice day. Sorry for the delay in response. For ionic project you need not to do that. just run below command cordova plugin add https://github.com/softdive/cordova-plugin-sms.git --save

and the plugin will get installed inside your project_root/plugins directory. Then you can directly use it in either controller.js or app.js or services.js etc... as smsrec.method_name()....... or navigator.smsrec.method_name().... below is the sample code, which worked for me- navigator.smsrec.startReception (function(msg) { console.log('message '+ JSON.stringify(msg)); // format - {"address":"+XXXXXXXXXX","body":"Hello sweet girl","date":1490348584250} }, function(err){console.log("err"+ err); });

In the github pages steps are for phonegap app I guess. Ionic is much simpler..

Also you can send your queries to basusharma1988@gmail.com rather than here, as it is for someone else' plugin issues.

Happy to help anytime.

Thanks Basu