Deploying shared resources

by Jargon » Thu, 25 Mar 2010 00:56:10 GMT

Sponsored Links

We are investigating the possibilities to package & deploy platform UI
extensions which can contain both Java code and resources - which then
can be (re-)used by applications using <uses-library> tag in the

One solution which has been discussed was to use the aapt -x option
together with the new --custom-package option introduced in November
to generate unique resource identifiers for the shared resource

Then, just as the <uses-library> information in the manifest file
would bootstrap the class loader with the listed  extension packages,
it would add these packages to the asset manager as well - allowing
the asset manager to locate and load the extension resources. (This
would require a platform extension.)

So, my question is really if this is a way forward - using the 8
package bits in the resource identifiers? This solution would probably
work initially for one vendor since the allocation of unique package
identifiers would be an internal issue, but if extension packages
where to be exchanged within the android community there would be a
high risk of packages using the same identifiers.

Jrgen Ekstrm
Software Engineer
Sony Ericsson


Deploying shared resources

by Mark Murphy » Thu, 25 Mar 2010 01:03:31 GMT


You and me both, though I'm not trying to use <uses-library>.

That's interesting -- I had not noticed --custom-package before. I will
need to do some experiments to see if this helps with the solution I'm
working on.

I'm trying to avoid anything that requires modifying the SDK, and I
agree that overloading <uses-library> this way would require such
modifications AFAIK.

What are the "8 package bits"?

The issue of identifier collisions is a well-understood one for those
who have done development before with reusable components or modular
operating systems. Everything from Linux's apt and yum to Ruby gems
requires unique identifiers. So long as there are a handful of popular
repositories, "first one in wins" should suffice there.

Hence, I am not that worried about that aspect of the problem too much.
Whoever comes up with a component packaging system just needs to also
run a repository.

Mark Murphy (a Commons Guy)  | 

_The Busy Coder's Guide to *Advanced* Android Development_
Version 1.4 Available!


Sponsored Links

Deploying shared resources

by Jargon » Wed, 31 Mar 2010 15:28:31 GMT

 n Mar 24, 7:03pm, Mark Murphy <> wrote:
Can you explain more of your strategy - and how to avoid platform
My initial plan is to do very small changes in the platform to enable
to build their own resource packages, just as framework-res.apk, since
of the stuff already seems to be there. Then looking into a more long-
term solution
which eliminates the "unique package identifier" issue which in
basically by replacing the top 8 package bits in the resource
identifier with a
namespace identifier, e.g. "". Such a solution would
introduction of third party packages just by adding them into the file
system since
their resources would not clash with existing ones.

This fix enabled us to use the aapt tool as is, without any patching.
Still we
are considering another option --custom-package-id which would enable
control of which package identifier is assigned to the generated

We were considering introducing a <uses-resources> tag but this would
require a lot more changes. To me, it feels natural to think that a
could hold both code and resources.

Each resource identifier consists of 32 bits were 8 top bits defines
package in which the resource belongs to. Platform resources are 0x01
and 0x7F are application resources. The idea is to use the remaining
253 values for extension packages.

With the introduction of namespace, e.g. "" such a
repository would
not be needed since they would eliminate resource clashing.


Other Threads

1. BOOT_COMPLETED BroadcastReceiver and AlarmManager not working


I have a broadcast receiver to handle BOOT_COMPLETED intent. In that
if we keep AlarmManager.set method is not working.

public void onReceive(Context context, Intent intent) {
Log.d("AlarmBootReceiver", " boot receiver 1 ");
                AlarmManager mgr=(AlarmManager)context.getSystemService
                Intent i=new Intent(context, OnAlarmReceiver.class);
                PendingIntent pi=PendingIntent.getBroadcast(context, 0, i, 0);

                Calendar calendar = Calendar.getInstance();
                calendar.add(Calendar.SECOND, 30);
                SimpleDateFormat sdf = new SimpleDateFormat();
                Log.d("AlarmRingerBootReceiver", " second " + sdf.format
                mgr.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 
AlarmReceiver: (it never gets triggered)

public void onReceive(Context context, Intent intent) {
                Log.d("AlarmReceiver", "it is not working ...");

Manifest file:

android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
        <application android:label="@string/app_name">
                        <receiver android:name=".OnBootReceiver">
android:name="android.intent.action.BOOT_COMPLETED" />
android:name="android.intent.category.LAUNCHER" />
                        <receiver android:name=".OnAlarmReceiver" 

Tried all combinations of android:exported="true" and other

Please help.....



2. hebrew font

how to install in htc g1 hebrew fonts?


3. QVGA is really suitable to Android or not?

4. doing the tutorial for HelloDatePicker

5. trouble getting HelloGallery example for android sdk 1.5 to work

6. How to open or register a new file extension in Android?

7. Is it possible to override Android's green and red buttons?