I know how to update my own programs, and I know how to open programs using the a predefined Uri (for sms or email for example)
I need to know how I can create an Intent to open MyTracks or any other application that I don't know what intents they listen to.
I got this info from DDMS, but I havn't been succesful in turning this to an Intent I can use. This is taken from when opening MyTracks manually.
Thanks for your help
05-06 11:22:24.945: INFO/ActivityManager(76): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.google.android.maps.mytracks/com.google.android.apps.mytracks.MyTracks bnds=[243,338][317,417] }
05-06 11:22:25.005: INFO/ActivityManager(76): Start proc com.google.android.maps.mytracks for activity com.google.android.maps.mytracks/com.google.android.apps.mytracks.MyTracks: pid=1176 uid=10063 gids={3003, 1015}
05-06 11:22:26.995: INFO/ActivityManager(76): Displayed activity com.google.android.maps.mytracks/com.google.android.apps.mytracks.MyTracks: 1996 ms (total 1996 ms)
Launch an application from another application on Android
Alternatively you can also open the intent from your app in the other app with:
where
uri
is the deeplink to the other appFirstly, the concept of "application" in Android is slightly an extended one.
An application - technically a process - can have multiple activities, services, content providers and/or broadcast listeners. If at least one of them is running, the application is up and running (the process).
So, what you have to identify is how do you want to "start the application".
Ok... here's what you can try out:
action=MAIN
andcategory=LAUNCHER
PackageManager
from the current context usingcontext.getPackageManager
packageManager.queryIntentActivity(<intent>, 0)
where intent hascategory=LAUNCHER
,action=MAIN
orpackageManager.resolveActivity(<intent>, 0)
to get the first activity with main/launcherActivityInfo
you're interested inActivityInfo
, get thepackageName
andname
category=LAUNCHER
,action=MAIN
,componentName = new ComponentName(packageName, name)
andsetFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(newIntent)
EDIT :
as suggested in comments, add one line before
startActivity(intent);
Use following: