title: How to get value from FCM data message in Android?
body: <p>I'm trying to implement FCM notification in my app. I have read FCM data message type will receive notification even when app is in background so am trying to implementing that in <code>onMessageRecieved</code> method am getting unexpected response like this:</p>
  
  <pre><code>{title =2, message={"Status":"UNASSIGNED","CompanyName":"gd","LastModifiedDateTime":"2017-04-25 18:59:41","IsPartRequired":false,"ProblemCategory":"CONFIGURATION","IsGeneralClaim":false,"RegistrationID":1057,"IncidentCode":"INS\/2017\/04\/25-0010","StatusID":0,"CreatedDateTime":"2017-04-25 18:59:41","IsInstallationCall":false}}
  </code></pre>
  
  <p>Don't know how to parse this get separate value from title and message let me post my firebase message code:</p>
  
  <pre><code>public class FireBaseMessage extends FirebaseMessagingService {
      private static final String TAG = "MyFirebaseMsgService";
  
      @Override
      public void onMessageReceived(RemoteMessage remoteMessage) {
          super.onMessageReceived(remoteMessage);
        Map&lt;String,String&gt; data = remoteMessage.getData();
          Log.d(TAG, "From: " + data.toString());
  // 
  }
  }
  </code></pre>
  
  <p>In this log message am getting response like that how to get value from that is try like:</p>
  
  <pre><code>int title=data.get("title"); 
  </code></pre>
  
  <p>getting null pointer as this is not in valid format.  In my server side i have am trying to post json format like this:</p>
  
  <pre><code>{
     "to":"es_OToDkj00:APA91bFqxbVMAaXy5fPtDbNVAkIwyVrPCmfGci2otHZPvdRoXPv-oDdjgtLR92Nqe8w6f57nCVceLbc3_zBWsInG9g1Pfdp3LvsMKyuaiYps0L1y3tn0N0XbzGseEI6jyiqs1r-sT9lb",
     "data":{
        "message":{
           "RegistrationID":1057,
           "IncidentCode":"INS/2017/04/25-0010",
           "CompanyName":"ABM INFOTECH",
           "StatusID":5,
           "Status":"ASSIGNED",
           "CreatedDateTime":"2017-04-25T12:03:45",
           "LastModifiedDateTime":"2017-04-25T18:59:41",
           "ProblemCategory":"CONFIGURATION",
           "IsPartRequired":false,
           "IsInstallationCall":false,
           "IsGeneralClaim":false
        },
        "title ":"1"
     }
  </code></pre>
  
  <p>Don't know where I'm making a mistake. Can anyone help me? Thanks in advance!</p>