I am a beginner with less idea ,now when i send notifications it always open the launcher activity,i want to open different links as per i set in values.Kindly Elaborate. Thanks
public class MyFireBaseMessagingService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Intent intent = new Intent(this,notifications.class);
intent.setFlags(intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this);
notificationBuilder.setContentTitle("Model Club ");
notificationBuilder.setContentText(remoteMessage.getNotification().getBody());
notificationBuilder.setAutoCancel(true);
notificationBuilder.setContentIntent(pendingIntent);
notificationBuilder.setSmallIcon(R.drawable.model);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0, notificationBuilder.build());//*/
}
In android manifest
<service android:name=".MyFirebaseInstantIdService">
<intent-filter>
<action android:name="com.google.firebase.modelclub.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<service android:name=".MyFireBaseMessagingService">
<intent-filter>
<action android:name="com.example.ankitavishek.modelclub.firebase.MESSAGING_ID_EVENT" />
</intent-filter>
</service>
<activity android:name=".notifications"
android:label="Notifications"
android:parentActivityName=".Home">
<intent-filter>
<action android:name="com.example.ankitavishek.modelclub_TARGET_NOTIFICATION" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>