[TIMOB-14001] Android: Allow sending extra data to the intent when opening a notification
GitHub Issue | n/a |
Type | New Feature |
Priority | Low |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | n/a |
Reporter | Davide Cassenti |
Assignee | Unknown |
Created | 2013-05-28T16:26:35.000+0000 |
Updated | 2018-02-28T20:04:06.000+0000 |
Description
Description of the problem
When clicking on a notification, if we want to restore the app which is in background, is currently not possible to understand if the click comes from the notification or not, as we cannot send extra data
Use case
When clicking on a notification, you want to switch to a particular tab/page of the app. Opening a NEW intent would work (e.g. we can create the intent with extra data), but if we use the currently open one (Ti.Android.currentActivity.intent) there is not way to provide such information.
Comments
JSON Source
[~dcassenti] Could you provide some clarification on what the issue is here? (A sample case would be helpful) Is there a reason why putExtra() would not work when you are creating a notification?
[~ayeung] The problem with putExtra is that, if you do not want to open a new intent, but re-opening the same one, you cannot use it. The idea would be to have something like:
Using this code, you are putting the EXTRA information in the current intent, and resuming it from outside the notification will have no difference.
I'm not sure I understand the issue. If you call putExtra() on the current intent, back out of the app, and then reopen it with the notification, then intent should have the extra that you placed there.
[~ayeung] Correct, but the intent also has the EXTRA if you resume it NOT from the notification in that case. The code works fine if the intent is new, as the EXTRA is not added to the running one, and resuming without a notification will not 'open' the one with the EXTRA data. Hope it helps