c# - Check if 'Restrict background data' is active on Windows Phone -
there settings in data sense 'restrict background data' , 'restrict background data when roamind'. blocking background tasks without notification application. how check state app, can alert user?
i think exception message way detect it. in background task sample code.
// place call add in try block in case user has disabled agents. try { scheduledactionservice.add( task ); } catch ( invalidoperationexception exception ) { if ( exception.message.contains( "bns error: action disabled" ) ) { // background agents application have been disabled user. } if ( exception.message.contains( "bns error: maximum number of scheduledactions of type have been added." ) ) { } //... }
Comments
Post a Comment