Handling an Intent without an Activity UI

by mafro » Tue, 09 Jun 2009 18:35:03 GMT

Sponsored Links
 Hey list,

I've searched for a few hours for a solution to this, so hopefully
this isn't a repost :s

I'm setting a shortcut on the Home screen which raises an Intent to my
application - the problem is that I don't want to show my app, just
run a little code and display a Toast notification.

This must be possible - I just can't work out how.. Once I'm handling
the shortcut Intent in onCreate() the UI has initialised and I get a
little screen flicker if I then run my code and finish().

Thanks for any input!


Handling an Intent without an Activity UI

by mafro » Wed, 10 Jun 2009 17:31:24 GMT

 I'm thinking I might need to write a service to handle my shortcut's
Intent. The main application could then raise a similar Intent to the
service to provide the same functionality whilst in the application.

Comments anyone?


Sponsored Links

Handling an Intent without an Activity UI

by Mark Murphy » Wed, 10 Jun 2009 20:10:06 GMT


I do not know if you can create home screen shortcuts that send
broadcast Intents. If you can, then register a BroadcastReceiver in your
manifest to catch some custom action, and set up your shortcut to send a
broadcast Intent with that action. If what you need to do takes only a
few seconds, you can do the work within the BroadcastReceiver;
otherwise, have the receiver call startService() to trigger some
IntentService to do the real work.

This seems terribly complex, compared to just giving the user a real
activity to work with, but, hey, it's your app... :-)

Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Warescription: Three Android Books, Plus Updates, $35/Year


Handling an Intent without an Activity UI

by mafro » Wed, 10 Jun 2009 21:02:47 GMT

 You're right it does sound terribly complex. Ill report back on my
findings for anyone else who has a similar problem.

Thanks for your input, Mark.


Other Threads

1. Email applications with multiple image attachments


I am trying to develop an application which should be capable of
sending multiple(around 6 images) images.I can send an email with one
image.I used
   sendIntent.putExtra(Intent.EXTRA_STREAM, pathtotheImage);
  for that.

my question is
    Is it possible to attach multiple file using an intent.
    If it is possible some of you can give me a code example

Thank in advance

2. Is Zoom in And Zoom out is Possible for Image View In android............


One More thing I need to Specify ....

I need to zoom in and Zoom out with Touch ... not with key events ....

Desu Vinod Kumar


3. Query and delete contact on SIM failed

4. How to display error messages to the user?

5. Security/Permissions issue

6. Maven Android Plugin: stable version 2.0.0 released

7. It looks like Android Market's payment options will be expanded