OutCallReceiver
3689 ワード
- public class OutCallReceiver extends BroadcastReceiver {
-
- @Override
- public void onReceive(Context context, Intent intent) {
- //
- String number = getResultData();
- if("20182018".equals(number)){
- Intent safeIntent = new Intent(context,LostProtectedActivity.class);
- // activity
- // activity .
- safeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- context.startActivity(safeIntent);
- setResultData(null);
- }
- }
- }
プロファイルへの書き込み:
- <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>
- <receiver android:name=".receiver.OutCallReceiver">
- <intent-filter android:priority="1000">
- <action android:name="android.intent.action.NEW_OUTGOING_CALL"/>
- </intent-filter>
- </receiver>