Đây là những gì tôi có cho đến nay nhưng không có gì xảy ra khi tôi đầu vào kết hợp này trong dialerAndroid. Khởi chạy ứng dụng từ Dialer
public class DialReceiver extends BroadcastReceiver
{
@Override
public void onReceive(Context context, final Intent intent) {
if (intent.getAction().equals(android.content.Intent.ACTION_NEW_OUTGOING_CALL)) {
String phoneNumber = intent.getExtras().getString(android.content.Intent.EXTRA_PHONE_NUMBER);
if(phoneNumber.equals("*#588637#")) {
Intent intent1 = new Intent(context , Activity.class);
intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent1);
}
}
}
}
và trong androidmanifest
<receiver
android:name=".receiver.DialReceiver"
android:exported="true"
android:process=":background"
tools:ignore="ExportedReceiver" >
<intent-filter>
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
android.intent doesnt exist – pedja
Xem giải pháp cập nhật, nó hoạt động tốt cho tôi. – ridoy
nó vẫn không hoạt động. Người nhận không nhận được phát sóng ở tất cả – pedja