java - [Android]Does Android System gerrentee the execution order of user defined Broadcast Receiver according to their android:priority? -


i designed component(packed in .jar file) contians service, , component contained in many applications(let's there might many applications have component in them, installed on 1 device). 1 instance of component expected exist on 1 deivce, means if component in 'a' application has been started, component in 'b' application not going started during 'a''s lifecycle.

and maybe day, there new application installed on device, new version of component. want make sure started component newest version.

so, want use broadcastreceiver , android:priority solution(the new version has higher priority). have make sure whether android system gerrentee sequence of excution(of broadcastreceiver.onreceive) according priority.

any 1 give me hint? thankful:)

in short: yes if use ordered broadcast.

according android doc :

ordered broadcasts (sent context.sendorderedbroadcast) delivered 1 receiver @ time. each receiver executes in turn, can propagate result next receiver, or can abort broadcast won't passed other receivers. order receivers run in can controlled android:priority attribute of matching intent-filter; receivers same priority run in arbitrary order.

so must define android:priority , must send ordered broadcast using : context.sendorderedbroadcast

note that, 1 of receiver can abort broacast won't propagated next receiver. (see : abortbroadcast)


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -