How to get data from Notification when app is killed or removed from background in Android Oreo











up vote
0
down vote

favorite












I need to get data from notification even when the app is killed/Not even in task or background. I am able to get data from notifications using broadcast receiver till nougat and saving it in room database. But my broadcast receiver is not being called in Oreo devices. It is called only when the app is in the foreground or background, not when the app is killed. I have read about using job scheduler in Oreo, but I am not sure that even it will be called when the app is killed because Oreo tries to save system resources right. Please suggest what should i do to get data from notification even when app is killed in oreo.










share|improve this question






















  • As per android documentation - " With limited exceptions, apps cannot use their manifest to register for implicit broadcasts. They can still register for these broadcasts at runtime, and they can use the manifest to register for explicit broadcasts targeted specifically at their app." Thats the reason you were able to get the broadcast.
    – Arpit
    Nov 12 at 6:16












  • Yes i read that already, i am trying to get solution for it. I have a requirement where i need to save notifications even when app is killed into an offline db. Its just not working in Oreo.
    – Maximus
    Nov 12 at 6:24












  • are you not using FCM, you will get the notification even when the app is killed. Or can you explain a bit about when and how you are generating notification
    – Arpit
    Nov 12 at 6:27










  • @Arpit i am using fcm, i am not talking about getting notifications, i am getting notification obviously, its just that i need its data even without clicking on it. So when notification comes, i need to get its data and save it.
    – Maximus
    Nov 12 at 6:49










  • i am just confirming. When the app is not in background then you will only get "notification":{ "title":"Portugal vs. Denmark", "body":"great match!" } not the data payload. check the documentation here firebase.google.com/docs/cloud-messaging/concept-options
    – Arpit
    Nov 12 at 6:54















up vote
0
down vote

favorite












I need to get data from notification even when the app is killed/Not even in task or background. I am able to get data from notifications using broadcast receiver till nougat and saving it in room database. But my broadcast receiver is not being called in Oreo devices. It is called only when the app is in the foreground or background, not when the app is killed. I have read about using job scheduler in Oreo, but I am not sure that even it will be called when the app is killed because Oreo tries to save system resources right. Please suggest what should i do to get data from notification even when app is killed in oreo.










share|improve this question






















  • As per android documentation - " With limited exceptions, apps cannot use their manifest to register for implicit broadcasts. They can still register for these broadcasts at runtime, and they can use the manifest to register for explicit broadcasts targeted specifically at their app." Thats the reason you were able to get the broadcast.
    – Arpit
    Nov 12 at 6:16












  • Yes i read that already, i am trying to get solution for it. I have a requirement where i need to save notifications even when app is killed into an offline db. Its just not working in Oreo.
    – Maximus
    Nov 12 at 6:24












  • are you not using FCM, you will get the notification even when the app is killed. Or can you explain a bit about when and how you are generating notification
    – Arpit
    Nov 12 at 6:27










  • @Arpit i am using fcm, i am not talking about getting notifications, i am getting notification obviously, its just that i need its data even without clicking on it. So when notification comes, i need to get its data and save it.
    – Maximus
    Nov 12 at 6:49










  • i am just confirming. When the app is not in background then you will only get "notification":{ "title":"Portugal vs. Denmark", "body":"great match!" } not the data payload. check the documentation here firebase.google.com/docs/cloud-messaging/concept-options
    – Arpit
    Nov 12 at 6:54













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I need to get data from notification even when the app is killed/Not even in task or background. I am able to get data from notifications using broadcast receiver till nougat and saving it in room database. But my broadcast receiver is not being called in Oreo devices. It is called only when the app is in the foreground or background, not when the app is killed. I have read about using job scheduler in Oreo, but I am not sure that even it will be called when the app is killed because Oreo tries to save system resources right. Please suggest what should i do to get data from notification even when app is killed in oreo.










share|improve this question













I need to get data from notification even when the app is killed/Not even in task or background. I am able to get data from notifications using broadcast receiver till nougat and saving it in room database. But my broadcast receiver is not being called in Oreo devices. It is called only when the app is in the foreground or background, not when the app is killed. I have read about using job scheduler in Oreo, but I am not sure that even it will be called when the app is killed because Oreo tries to save system resources right. Please suggest what should i do to get data from notification even when app is killed in oreo.







android android-studio android-8.0-oreo android-jobscheduler






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 12 at 6:08









Maximus

355




355












  • As per android documentation - " With limited exceptions, apps cannot use their manifest to register for implicit broadcasts. They can still register for these broadcasts at runtime, and they can use the manifest to register for explicit broadcasts targeted specifically at their app." Thats the reason you were able to get the broadcast.
    – Arpit
    Nov 12 at 6:16












  • Yes i read that already, i am trying to get solution for it. I have a requirement where i need to save notifications even when app is killed into an offline db. Its just not working in Oreo.
    – Maximus
    Nov 12 at 6:24












  • are you not using FCM, you will get the notification even when the app is killed. Or can you explain a bit about when and how you are generating notification
    – Arpit
    Nov 12 at 6:27










  • @Arpit i am using fcm, i am not talking about getting notifications, i am getting notification obviously, its just that i need its data even without clicking on it. So when notification comes, i need to get its data and save it.
    – Maximus
    Nov 12 at 6:49










  • i am just confirming. When the app is not in background then you will only get "notification":{ "title":"Portugal vs. Denmark", "body":"great match!" } not the data payload. check the documentation here firebase.google.com/docs/cloud-messaging/concept-options
    – Arpit
    Nov 12 at 6:54


















  • As per android documentation - " With limited exceptions, apps cannot use their manifest to register for implicit broadcasts. They can still register for these broadcasts at runtime, and they can use the manifest to register for explicit broadcasts targeted specifically at their app." Thats the reason you were able to get the broadcast.
    – Arpit
    Nov 12 at 6:16












  • Yes i read that already, i am trying to get solution for it. I have a requirement where i need to save notifications even when app is killed into an offline db. Its just not working in Oreo.
    – Maximus
    Nov 12 at 6:24












  • are you not using FCM, you will get the notification even when the app is killed. Or can you explain a bit about when and how you are generating notification
    – Arpit
    Nov 12 at 6:27










  • @Arpit i am using fcm, i am not talking about getting notifications, i am getting notification obviously, its just that i need its data even without clicking on it. So when notification comes, i need to get its data and save it.
    – Maximus
    Nov 12 at 6:49










  • i am just confirming. When the app is not in background then you will only get "notification":{ "title":"Portugal vs. Denmark", "body":"great match!" } not the data payload. check the documentation here firebase.google.com/docs/cloud-messaging/concept-options
    – Arpit
    Nov 12 at 6:54
















As per android documentation - " With limited exceptions, apps cannot use their manifest to register for implicit broadcasts. They can still register for these broadcasts at runtime, and they can use the manifest to register for explicit broadcasts targeted specifically at their app." Thats the reason you were able to get the broadcast.
– Arpit
Nov 12 at 6:16






As per android documentation - " With limited exceptions, apps cannot use their manifest to register for implicit broadcasts. They can still register for these broadcasts at runtime, and they can use the manifest to register for explicit broadcasts targeted specifically at their app." Thats the reason you were able to get the broadcast.
– Arpit
Nov 12 at 6:16














Yes i read that already, i am trying to get solution for it. I have a requirement where i need to save notifications even when app is killed into an offline db. Its just not working in Oreo.
– Maximus
Nov 12 at 6:24






Yes i read that already, i am trying to get solution for it. I have a requirement where i need to save notifications even when app is killed into an offline db. Its just not working in Oreo.
– Maximus
Nov 12 at 6:24














are you not using FCM, you will get the notification even when the app is killed. Or can you explain a bit about when and how you are generating notification
– Arpit
Nov 12 at 6:27




are you not using FCM, you will get the notification even when the app is killed. Or can you explain a bit about when and how you are generating notification
– Arpit
Nov 12 at 6:27












@Arpit i am using fcm, i am not talking about getting notifications, i am getting notification obviously, its just that i need its data even without clicking on it. So when notification comes, i need to get its data and save it.
– Maximus
Nov 12 at 6:49




@Arpit i am using fcm, i am not talking about getting notifications, i am getting notification obviously, its just that i need its data even without clicking on it. So when notification comes, i need to get its data and save it.
– Maximus
Nov 12 at 6:49












i am just confirming. When the app is not in background then you will only get "notification":{ "title":"Portugal vs. Denmark", "body":"great match!" } not the data payload. check the documentation here firebase.google.com/docs/cloud-messaging/concept-options
– Arpit
Nov 12 at 6:54




i am just confirming. When the app is not in background then you will only get "notification":{ "title":"Portugal vs. Denmark", "body":"great match!" } not the data payload. check the documentation here firebase.google.com/docs/cloud-messaging/concept-options
– Arpit
Nov 12 at 6:54

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53256682%2fhow-to-get-data-from-notification-when-app-is-killed-or-removed-from-background%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53256682%2fhow-to-get-data-from-notification-when-app-is-killed-or-removed-from-background%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python