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!
mafro

--~--~---------~--~----~------------~-------~--~----~



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. "Wiring" emulator services to PC's

All:

Is it possible to use a laptop's bluetooth (wireless connection, WiFi,
etc.) to "wire" them to the android emulator so that they can be used/
tested from within code as if the application was running on the
"real" thing.

Regards ...

--~--~---------~--~----~------------~-------~--~----~

2. Carrymobile 's HTC Dream/T-Mobile G1/Google Andriod leather case released

Carrymobile 's HTC Dream/T-Mobile G1/Google Andriod leather case
released

--~--~---------~--~----~------------~-------~--~----~

3. pop3

4. G1 Leather Case

5. Nested Call Log

6. Using the android logo (both graphical and text)

7. [Contacts] Business contacts don't display Company when Name is not available