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. gallery displaying RelativeLayout?

I'm trying to have my gallery display RelativeLayouts instead of
ImageViews, using the code from:
http://code.google.com/android/samples/ApiDemos/src/com/google/android/samples/view/Gallery1.html


My getView code looks like this, but I get null pointers and nothing
works:
 public View getView(int position, View convertView, ViewGroup parent)
{
        RelativeLayout i = (RelativeLayout) findViewById(R.id.ae);

                switch(position) {
            case 1:             i = (RelativeLayout) findViewById(R.id.am);
            case 2:             i = (RelativeLayout)
findViewById(R.id.ap);
                }
                // i.setImageResource(mImageIds[position]);
                // i.setScaleType(ImageView.ScaleType.FIT_XY);
                //i.setLayoutParams(new Gallery.LayoutParams(100, 65));
                return i;
            }
--~--~---------~--~----~------------~-------~--~----~

2. Service starts on Alarm

I want the program to allow a user to define a specific time and
date.. and a message should appear when the schedule is triggered.
Like if I set the time and date to 12 am, April 14, 2008, a message
should appear on that time. How do you suggest me to do that? Thanks..
--~--~---------~--~----~------------~-------~--~----~

3. emulator of m5-rc15 problem

4. Failed to open database file

5. Launch Aborted

6. XferMode

7. Confusing Problem about VideoView