It would be helpful if it could support the access using also the
resource name and not only its ID: "android.resource://package.name/
raw/resource_name"
Thanks,
Adriano Crestani
On Mar 18, 4:02 pm, Ajaleo <[EMAIL PROTECTED]> wrote:
> Thanks a lot.
>
> It worked perfectly
>
> If anyone is interested here you can find an excerpt of my code:
>
> Notification notification = new Notification();
> notification.tickerText="This is the notification text";
> notification.icon=R.drawable.message;
> String uriStr = "android.resource://"+ PACKAGE_NAME+ "/" +
> R.raw.myringtone;
> Uri uri = Uri.parse(uriStr);
> notification.sound=uri;
> manager.notify(NOTIFICATION_MESSAGE,notification);
>
> On 18 mar, 20:49, "Joe Onorato" <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > Thanks for the input. There is an android.resource scheme that is supported
> > to access resources. I realized that this isn't documented anywhere, so
> > here is a preview of the documentation that I just added. Hope this helps.
>
> > -joe
>
> > The android.resource
> > (SCHEME_ANDROID_RESOURCE<file://localhost/android/main/out/target/common/docs/framework/reference/android/content/ContentResolver.html#SCHEME_ANDROID_RESOURCE>)
> > Scheme
>
> > A Uri object can be used to reference a resource in an APK file. The Uri
> > should be one of the following formats:
>
> > - android.resource://package_name/id_number
> > package_name is your package name as listed in your
> > AndroidManifest.xml. For example com.example.myapp
> > id_number is the int form of the ID.
> > The easiest way to construct this form is
>
> > Uri uri = Uri.parse("android.resource://com.example.myapp/" +
> > R.raw.my_resource");
>
> > - android.resource://package_name/type/name
> > package_name is your package name as listed in your
> > AndroidManifest.xml. For example com.example.myapp
> > type is the string form of the resource type. For example, raw or
> > drawable. name is the string form of the resource name. That is,
> > whatever the file name was in your res directory, without the type
> > extension. The easiest way to construct this form is
>
> > Uri uri =
> > Uri.parse("android.resource://com.example.myapp/raw/my_resource");
>
> > On 3/18/08, Ajaleo <[EMAIL PROTECTED]> wrote:
>
> > > Hi All,
>
> > > I'm trying to show a notification with a custom sound packed inside
> > > the apk file in res/raw folder. I've tried to play the file in a
> > > notification but the property sound of the notification object is an
> > > Uri which I don't know how to map to my resource. The only way I've
> > > found to play the sound is to write into the filesystem before and
> > > build the Uri from the file I've created. So the question is if there
> > > is any way to create a Uri that represents an application resource.
>
> > > Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---