I have a fairly basic android app that is a tabhost of 4 tabs, each one opens a webview. The app also has GCM all setup and currently can receive messages fine. When a message is received though, you click on it and it simply opens the app the same way clicking on the App icon would open the app. What I am trying to do though is open a particular tab inside the app when someone clicks on message and what would be even better is if I could open any tab depending on what the message is. Is this possible? If so, how would I go about doing this?
From what I have found so far, I think this involves something with adding an additional item in the payload of the message such as
{
"registration_id" : "APA91bHun4MxP5egoKMwt2KZFBaFUH-1RYqx...",
"data" : {
"message" : "Text notification goes here",
"tab" : "2"
},
}
and then possibly doing something with the intents which I am not sure how to do. Am I on the right track and can anyone help me with this?
You can add an extra to the pending intent that you pass to the notification that will indicate which tab to open.
And when the activity starts check for that extra and open the tab accordingly.