You need to publish and implement an activity, not a receiver.
On Thu, Apr 16, 2009 at 1:26 PM, Keith Wiley <[email protected]> wrote:
>
> I would like my app to pop up in the list of options for opening
> certain file types in the various file manager, email, and web browser
> apps. I'm having trouble figuring out how to begin. I haven't found
> any examples of this sort of thing yet.
>
> Don't I need to know what kind of action the other app is trying to
> invoke on a selected file? How can I possibly know that? Or should I
> simply assume that all file manager, email, and browser apps will
> always use ACTION_VIEW or perhaps ACTION_EDIT when trying to send a
> file to another app? Must I simply assume this and hope I'm right?
> There are so many possible apps to try to get this to work with, how
> do I make it receive a "open-file" command from any arbitrary app?
>
> Is the code below correct so far? I have the following in the
> manifest:
>
> <receiver
> android:enabled="true"
> android:exported="true"
> android:label="Some Label, where does this show up?"
> android:name=".MyBroadcastReceiver" >
> <intent-filter>
> <action
> android:name="android.intent.action.ACTION_EDIT" />
> </intent-filter>
> <intent-filter>
> <action
> android:name="android.intent.action.ACTION_VIEW" />
> </intent-filter>
> </receiver>
>
> I don't see how to specify a file-type or file extension filter in the
> receiver. How do I do this? Likewise I have the following in the
> receiver:
>
> public class MyBroadcastReceiver extends BroadcastReceiver {
> @Override
> public void onReceive(Context context, Intent intent) {
> if
> (intent.getAction().equals("android.intent.action.ACTION_EDIT")
> ||
> intent.getAction().equals("android.intent.action.ACTION_VIEW"))
> {
> Uri uri = intent.getData();
> String uriStr = intent.getDataString();
> }
> }
> }
>
> Is that how I'm supposed to do it? Do I assume the that file manager,
> email. or browser app will send the file to my app by sending a file
> URI or URL (I'm unclear on the distinction) in the data field of the
> intent? To be honest, I'm not sure if I'm even close to the mark on
> this? Is this code wildly off-base?
>
> Any assistance is greatly appreciated. I'm not sure where to find out
> how to do this.
>
> Thank you very much.
>
> Cheers!
> >
>
--
Dianne Hackborn
Android framework engineer
[email protected]
Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails. 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---