[android-developers] Re: Storing data in the APK after creating it

2009-02-05 Thread Georgios Galyfos
thanks for all your replies!

I think using metadata on the manifest file is the only way of doing this:

I have tried to get the metadata stored in the AndroidManifest.xml

My manifest file is the one below:

 *XML:*  ?xml version=1.0 encoding=utf-8?
manifest xmlns:android=http://schemas.android.com/apk/res/android;
  package=org.android.androidapp
  android:versionCode=1
  android:versionName=1.0.0
uses-permission android:name=android.permission.INTERNET/
application android:icon=@drawable/icon android:label=
@string/app_name
meta-data
android:name=org.android.androidapp.webURL
android:value=http://www.google.com/
activity android:name=.App
  android:label=@string/app_name
intent-filter
action android:name=android.intent.action.MAIN /
category android:name=android.intent.category.LAUNCHER /
/intent-filter
/activity
/application
/manifest



and the code in my onCreate() is the one below:

 *Java:*ComponentInfo ci = new ComponentInfo();

PackageManager pm = getPackageManager();

XmlResourceParser myParser = ci.loadXmlMetaData(pm,
org.android.androidapp.webURL);


Unfortunately, the myParser value gets a null value...

Does anyone know what I am doing wrong? Please help, this is urgent..

I also tried the following:

 *Java:*  Bundle b = ci.metaData;


but this also returns null...

Whats the correct syntax of things for me to get the metadata value (the
webUrl stored in my metadata)

any help would be highly appreciated!!


On Wed, Feb 4, 2009 at 7:59 PM, Dianne Hackborn hack...@android.com wrote:

 An .apk is really just a zip file (and a jar file too), so in theory you
 can use any zip tools you want on it, you just need to make sure that you
 correctly re-sign it after making changes.  There is a caveat, however, that
 aapt does a few special things to make sure to not compress certain files
 and enforce alignment of uncompressed files for more efficient access at
 runtime; you'll want to make sure you don't lose these things if using
 normal zip tools.

 The aapt command also has some zip-like options to add and remove files.

 On Wed, Feb 4, 2009 at 9:49 AM, Georgios Galyfos yorg...@gmail.comwrote:

 thanks for the reply, however I am trying to do this without needing to
 rebuild the APK..


 On Wed, Feb 4, 2009 at 7:46 PM, Mark Murphy mmur...@commonsware.comwrote:


 Yorgos wrote:
  Do you have any other ideas of how I can store/alter information into
  the APK?

 Simple answer: Just re-run Ant to rebuild/resign your APK after
 modifying the XML.

 More complicated answer: Tease out the specific steps from Ant that will
 achieve those ends. I think you will need aapt and apkbuilder at minimum.

 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com
 Android Training in Sweden -- http://www.sotrium.com/training.php








 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support.  All such questions should be posted on public
 forums, where I and others can see and answer them.



 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Storing data in the APK after creating it

2009-02-04 Thread Mark Murphy

Yorgos wrote:
 Do you have any other ideas of how I can store/alter information into
 the APK?

Simple answer: Just re-run Ant to rebuild/resign your APK after
modifying the XML.

More complicated answer: Tease out the specific steps from Ant that will
achieve those ends. I think you will need aapt and apkbuilder at minimum.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android Training in Sweden -- http://www.sotrium.com/training.php

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Storing data in the APK after creating it

2009-02-04 Thread Georgios Galyfos
thanks for the reply, however I am trying to do this without needing to
rebuild the APK..

On Wed, Feb 4, 2009 at 7:46 PM, Mark Murphy mmur...@commonsware.com wrote:


 Yorgos wrote:
  Do you have any other ideas of how I can store/alter information into
  the APK?

 Simple answer: Just re-run Ant to rebuild/resign your APK after
 modifying the XML.

 More complicated answer: Tease out the specific steps from Ant that will
 achieve those ends. I think you will need aapt and apkbuilder at minimum.

 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com
 Android Training in Sweden -- http://www.sotrium.com/training.php

 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Storing data in the APK after creating it

2009-02-04 Thread Sundog

I'm pretty sure this cannot be done.

On Feb 4, 10:49 am, Georgios Galyfos yorg...@gmail.com wrote:
 thanks for the reply, however I am trying to do this without needing to
 rebuild the APK..



 On Wed, Feb 4, 2009 at 7:46 PM, Mark Murphy mmur...@commonsware.com wrote:

  Yorgos wrote:
   Do you have any other ideas of how I can store/alter information into
   the APK?

  Simple answer: Just re-run Ant to rebuild/resign your APK after
  modifying the XML.

  More complicated answer: Tease out the specific steps from Ant that will
  achieve those ends. I think you will need aapt and apkbuilder at minimum.

  --
  Mark Murphy (a Commons Guy)
 http://commonsware.com
  Android Training in Sweden --http://www.sotrium.com/training.php- Hide 
  quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Storing data in the APK after creating it

2009-02-04 Thread Dianne Hackborn
An .apk is really just a zip file (and a jar file too), so in theory you can
use any zip tools you want on it, you just need to make sure that you
correctly re-sign it after making changes.  There is a caveat, however, that
aapt does a few special things to make sure to not compress certain files
and enforce alignment of uncompressed files for more efficient access at
runtime; you'll want to make sure you don't lose these things if using
normal zip tools.

The aapt command also has some zip-like options to add and remove files.

On Wed, Feb 4, 2009 at 9:49 AM, Georgios Galyfos yorg...@gmail.com wrote:

 thanks for the reply, however I am trying to do this without needing to
 rebuild the APK..


 On Wed, Feb 4, 2009 at 7:46 PM, Mark Murphy mmur...@commonsware.comwrote:


 Yorgos wrote:
  Do you have any other ideas of how I can store/alter information into
  the APK?

 Simple answer: Just re-run Ant to rebuild/resign your APK after
 modifying the XML.

 More complicated answer: Tease out the specific steps from Ant that will
 achieve those ends. I think you will need aapt and apkbuilder at minimum.

 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com
 Android Training in Sweden -- http://www.sotrium.com/training.php




 



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---