Hi i am working on calling app, but when someone call to me i got notification and onclick is working fine on notification, but i want to open activity without click on push notification, how it is possible because i try many codes but nothing works in Android 13.
My Broadcastreceiver is:-
public void onReceive(Context context, Intent intent) {
if (intent != null && intent.getExtras() != null) {
Intent openActivityIntent = new Intent(context, AudioViewReceiving.class);
PendingIntent pi = PendingIntent.getActivity(context, 0, openActivityIntent,
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
try {
pi.send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
}
This is my FirebaseMessagingService class intent:-
Intent openActivityIntent = new Intent(this, AudioViewReceiving.class);
openActivityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(openActivityIntent);
Manifest is:-
<service
android:name=".Notification.MyFirebaseMessagingService"
android:enabled="true"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<receiver
android:name=".AudioVideoCall.MessageReceiveBroadcast"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</receiver>
This code is working is app is on Foreground but in background not, please suggest any idea for android 13, Thanks.