android - Sticky broadcasts rebroadcast -


i want change extras of sticky broadcast, call sendstickybroadcast same intent creates new sticky broadcast or replaces previous one?

also, use sticky broadcast maintain state of property , share state whoever wants (services , activities), there better approach share state of property between android classes?

does call sendstickybroadcast same intent creates new sticky broadcast or replaces previous one?

it replaces current 1 in case intent filter equal previous 1 been broadcast

i not use sticky broadcast because it been deprecated security reasons android 5.

also, experience - using sticky broadcast reason describes can cause easy tons of bugs , unexpected behaviors if not considering every case onreceive() can called...

is there better approach share state of property between android classes?

yes. there better ways save state across different application components, depends on specific use case:

  • save state field (or object) within singleton class. implementing class singleton provide global access other application component. singleton state save long process alive..

  • in case need save state , restore after application process stops, should save state in 1 of persistent ways so: sharedpreference choice saving persistently primitive types strings, integers..

  • storing state sqlite database whould choice more complex objects , lists..


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -