matthew womersley
Mar 15, 2016
10:40 pm

How to restrict all outgoing calls apart from a few specified ones

Hi

 

I'm trying restrict the phone from making any outgoing calls apart from say 2 numbers.

I've resticted all outgoing calls using the .* pattern the added 2 numbers which don't exist 3333 and 6666. (for testing).

If i dial either of these numbers, i'd expect to get a number not recognized response, which i do.

if a dial a real number, then i would expect the number not to be dialable, unfortunatley it can still be dialed.

I have included

<uses-permission android:name="android.permission.sec.MDM_PHONE_RESTRICTION" />

 

PhoneRestrictionPolicy phoneRestrictionPolicy = edm.getPhoneRestrictionPolicy(); 
try { // previous patterns remain and the new pattern is added
    // to allow incoming calls
    if (phoneRestrictionPolicy.setOutgoingCallRestriction(".*")) 
{ Log.d(TAG, "success adding outgoing call exception pattern"); 
} else { 
Log.w(TAG, "failed adding outgoing call exception pattern"); 
}
 if (phoneRestrictionPolicy.addOutgoingCallExceptionPattern("3333")) { 
Log.d(TAG, "success adding outgoing call exception pattern"); 
} else { 
Log.w(TAG, "failed adding outgoing call exception pattern");
 } 
if (phoneRestrictionPolicy.addOutgoingCallExceptionPattern("6666")) {
 Log.d(TAG, "success adding outgoing call exception pattern"); 
} else { 
Log.w(TAG, "failed adding outgoing call exception pattern"); 
} 

} catch (SecurityException e) { 
Log.w(TAG, "SecurityException: " + e);
 }

thanks in advance

 

Matt

Similar topics

No similar topics found.
Mar 16, 2016
1:57 pm

Hi Matt,

I reproduced your code, however I can block all number expect 3333 and 6666.

Can you please give us information about device you are using for test ?
Regards

Comments

Hi Lukasz

Thanks for getting back to me.

I'm testing on a Samsung Galaxy S7 edge.

Knox 2.6

Standard SDK 5.6.0

Premium SDK 2.6.0

Customization SDK 2.6.0

container 2.6.0

I normally test on a Galaxy Core prime. i will test on that one later

 

regards

 

Matt

matthew womersleyMar 16, 2016 at 2:12 pm

Hi Lukasz

I am using Standard 5.5 sdk, i thought i may need standard 5.6 so i tried switching the jar file but i got the following error

 

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 2

 

I think that is to do with duplicate class names. I noticed that there is an edm, rc and a license jars in 5.6.

 

Anyway  i switched back to using standard 5.5 sdk and deleted app and re-installed it and everything works fine now.

 

Sorry about that, not sure why it didn't work 1st time around.

 

Thanks for your help.

 

kind regards

 

Matt

matthew womersleyMar 16, 2016 at 9:59 pm