OutCallReceiver



  
  
  
  
  1. public class OutCallReceiver extends BroadcastReceiver { 
  2.  
  3.     @Override 
  4.     public void onReceive(Context context, Intent intent) { 
  5.         //    
  6.         String number  = getResultData(); 
  7.         if("20182018".equals(number)){ 
  8.             Intent safeIntent  = new Intent(context,LostProtectedActivity.class); 
  9.             // activity 
  10.             // activity . 
  11.             safeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
  12.             context.startActivity(safeIntent); 
  13.             setResultData(null); 
  14.         } 
  15.     } 

プロファイルへの書き込み:
 

  
  
  
  
  1. <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/> 


 


   
   
   
   
  1. <receiver android:name=".receiver.OutCallReceiver"> 
  2.            <intent-filter android:priority="1000"> 
  3.                <action android:name="android.intent.action.NEW_OUTGOING_CALL"/> 
  4.            </intent-filter> 
  5.        </receiver>