title: How do I pass custom data (web url ) in app server just like in Firebase (Android)
body: <p>I have an app, whereby I can send push notification to android phone from php-server. In Firebase console it works perfectly well, I am able to include the url in custom data field, such that when the user clicks on the push notification, a webview is opened, which opens up the url (in the custom data field).</p>
  
  <p>how can i pass the custom data also from the server such that when user clicks on push notification, the url in webview is opened.</p>
  
  <p><strong>Firebase Messaging Service</strong></p>
  
  <pre><code>public class MyFirebaseMessagingService extends FirebaseMessagingService{
  private final String CHANNEL_ID="notificcation";
  @Override
  public void onNewToken(String s) {
      super.onNewToken(s);
      Log.e("NEW_TOKEN",s);
  
      FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener(new OnSuccessListener&lt;InstanceIdResult&gt;() {
          @Override
          public void onSuccess(InstanceIdResult instanceIdResult) {
              String token = instanceIdResult.getToken();
              // Do whatever you want with your token now
              // i.e. store it on SharedPreferences or DB
              // or directly send it to server
              SharedPreferences sharedPreferences=getApplicationContext().getSharedPreferences(getString(R.string.FCM_PREF), Context.MODE_PRIVATE);
              SharedPreferences.Editor editor=sharedPreferences.edit();
              editor.putString(getString(R.string.FCM_TOKEN),token);
              editor.commit();
  
          }
      });
  
  }
  
  
  
  @Override
  public void onMessageReceived(RemoteMessage remoteMessage) {
  
      handleMessage(remoteMessage.getData().get(Config.STR_KEY));
  
  
  
  
  
  
  
  
  }
  
  
  
  
  
  
  private void handleMessage(String message) {
  
      Intent pushNotification=new Intent(Config.STR_PUSH);
      pushNotification.putExtra(Config.STR_MESSAGE,message);
      LocalBroadcastManager.getInstance(this).sendBroadcast(pushNotification);
  
  
  }
  </code></pre>
  
  <p>}</p>