I have a background service that receive notification data messages and i want that is the main activity of the app who will process then. When the main activity is running, i can send the data message to it via LocalBroadcastManager
, but my problem is when the main activity is not running ! How the service can send message to the main activity in the way that the main activity will receive the message when it's will start ?
Asked
Active
Viewed 33 times
0

zeus
- 12,173
- 9
- 63
- 184
-
you can save that data in local storage either database or shared preference and when your activity starts check for the value and proceed accordingly – Vivek Mishra May 10 '17 at 08:02
-
how you will do this using shared preference ? i mean is their anyway using shared preference to store data in `row` (several records with their fields) like in database ? – zeus May 10 '17 at 08:12
-
You can save array list in shared preference too – Vivek Mishra May 10 '17 at 08:13
-
that sound perfect ! deserve to be the answer :) – zeus May 10 '17 at 08:14
-
Posted as an answer – Vivek Mishra May 10 '17 at 08:17
1 Answers
1
you can save that data in local storage either database or shared preference and when your activity starts check for the value and proceed accordingly.
Also you can save custom array list too in shared preference using gson library easily

Vivek Mishra
- 5,669
- 9
- 46
- 84
-
-
-
-
check this http://stackoverflow.com/questions/31985925/save-arraylist-in-shared-preference – Vivek Mishra May 10 '17 at 08:32