How to programatically launch an installed app?

by Yasser » Sat, 11 Jul 2009 04:02:29 GMT


Sponsored Links
 Hi,

I want to launch/start an already installed application like
Calculator on Android and then send some keystrokes to it.

Is there a way to programatically launch an app without having access
to its code?

Thanks
Yasser
--~--~---------~--~----~------------~-------~--~----~



How to programatically launch an installed app?

by Mark Murphy » Sat, 11 Jul 2009 04:24:13 GMT


 


You cannot send keystrokes to other applications.


If you can find out an Intent that launches it, you use startActivity()
like you would any other activity. Finding the proper Intent can be a
bit tricky, though there are methods on the PackageManager class that
may help you identify what is launchable.

Bear in mind, though, that unless those Intents are publicly documented,
they are likely to break in future releases of Android (or of whatever
3rd party app you attempt to launch).

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

Need help for your Android OSS project?  http://wiki.andmob.org/hado 

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


Sponsored Links


How to programatically launch an installed app?

by Yasser » Sat, 11 Jul 2009 07:02:23 GMT


 To know the intent for an activity in order to launch it, do I need to
have access to the app source code?






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



How to programatically launch an installed app?

by Mark Murphy » Sat, 11 Jul 2009 07:05:46 GMT


 


Ideally, you have documentation telling you "hey, it is perfectly
acceptable to use this Intent to launch my application: ...".

Now, you can find out possible Intents other ways -- use PackageManager,
watch messages in LogCat, examine the source code -- but any of those
techniques may result in you creating something that will be unsupported
over time.

So, no, you do not necessarily need the source code, though it helps.

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

Android Development Wiki:  http://wiki.andmob.org 

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



How to programatically launch an installed app?

by Yasser » Sat, 11 Jul 2009 07:40:44 GMT


 Thanks a lot Mark, that clarified my doubts.





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



Other Threads

1. How to disable 3G/GRPS

Hi,
Is it possible to disable 3G or GPRS, even when no WiFi is available?
I'm using the Dev Phone, so I want to limit data charges.

Thanks.
--~--~---------~--~----~------------~-------~--~----~

2. Can't open dex cache error with SDK 1.1

Recently I switched to SDK 1.1 and it worked for a short time without
any problems. Now I'm getting "Can't open dex cache '/data/dalvik-
cache/system ..." error and emulator doesn't start at all. Just shows
Android screen of death with blinking cursor. When I repoint Eclipse
back to 1.0 r2 it works fine.

I did adb shell and /data folder is empty

Help
--~--~---------~--~----~------------~-------~--~----~

3. Does the web browser that came with Android support svg files?

4. Execute setprop from application

5. How can I dynamically add item to a Gallery in android

6. Accessing the sound input/output stream in the phone (sound modulation, sound synthesis, DTMF)

7. How about running WinCE apps on Android?