Using android:priority is an interesting idea ! I didn't even know it
was there.

Reading from the docs, I see that
"When an intent could be handled by multiple activities with different
priorities, Android will consider only those with higher priority
values as potential targets for the intent."
and then something about broadcast receivers.

But nothing about services so does this not apply to services ?
Because if it did, my problem would be solved just by incrementing
this !

Thanks


On 18 déc, 02:39, John Seghers <jsegh...@cequint.com> wrote:
> Here is one possibility: use ordered BroadcastReceivers with
> android:priority attributes to determine which service is newest.
>
> Each APK has its copy of the Service and a BroadcastReceiver.
> The intent-filter for the BroadcastReceiver has the android:priority
> attribute. Upon each release across all of these apps, you increment
> the priority so that the newer the APK (and thus the service) the
> higher the priority.
>
> When you want to invoke a service, first use
> Context.sendOrderedBroadcast to send an intent to the
> BroadcastReceivers in the apps. The one with the highest priority will
> be called first. You can then return to the caller an Intent to be
> used to start the service in that APK.
>
> Returning the Intent can be handled in one of two ways:
> * Use BroadcastReceiver.setResultExtras() to store the Intent and
> BroadcastReceiver.setResultCode to indicate that this has been
> handled. All the other BRs along the way should check the ResultCode
> to see if it has been set before responding themselves.  The last BR
> in the chain would be the one supplied to the sendOrderedBroadcast()
> function.
> * Instead, you can pass a PendingIntent (such as from
> Activity.createPendingResult()) in an Extra in the initial broadcast
> intent. Then the first BR to receive the intent calls
> BroadcastReceiver.abortBroadcast() to prevent the intent from going to
> any of the older versions. The BR returns the service intent via the
> PendingIntent.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to