Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49237

Run time permissions not working in Ionic3

$
0
0

@Ram1122 wrote:

I am trying to read List of SMS using below code and when i run below code its shows me Run time permissions dialog and i allowed relevant permission and even i enable READ_SMS permission ReadListSMS() method is not calling what did i do wrong in below code,Can some one help me please

Code:

> ionViewDidLoad(){
>     this.androidPermissions.checkPermission
>     (this.androidPermissions.PERMISSION.READ_SMS).then(
>     success => {    
>     //if permission granted
>     this.ReadListSMS();
>     },
>     err =>{
>     this.androidPermissions.requestPermission
>     (this.androidPermissions.PERMISSION.READ_SMS).
>     then(success=>{
>     **NOT CALLING HERE**
>     this.ReadListSMS();
>     },
>     err=>{
>     });
>     });
>     this.androidPermissions.requestPermissions
>     ([this.androidPermissions.PERMISSION.READ_SMS]);
> }
> 
> ReadListSMS()
> {
> 
> this.platform.ready().then((readySource) => {
> 
> let filter = {
>        box : 'inbox', // 'inbox' (default), 'sent', 'draft'
>        indexFrom : 0, // start from index 0
>        maxCount : 10, // count of SMS to return each time
>             };
>        if(SMS) SMS.listSMS(filter, (ListSms)=>{
>         console.log('Dismissed toast'+JSON.stringify(ListSms));
>         this.mesagesList = <BankObject[]>JSON.parse(JSON.stringify(ListSms));
>         //this.mesagesList = ListSms
>         var object = this.mesagesList[0];
>         let toast = this.toastCtrl.create({
>           message: object.body,
>           duration: 3000,
>           position: 'top'
>         });
> 
>         toast.onDidDismiss(() => {
>           console.log('Dismissed toast');
>         });
> 
>         toast.present();
>           },
>           Error=>{
>               console.log('Dismissed toast');
>           });
>     });
>   }
> ```

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49237

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>