

PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, alarmClockIntent, 0) Intent alarmClockIntent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER) įor(int i=0 i " + packageName + "/" + className) PackageManager packageManager = context.getPackageManager() Thus, your app is going to be constantly breaking on new phones, if you rely on being able to open the clock app. I would suggest against trying to create a huge if statement like you have, since the app could be different not only with different sdk versions, but with different phones since the phone manufacturers can choose to replace apps. If the clock apps don't have this, then there is no good way to accomplish what you want. Unfortunately, you need to app developers to agree to all implement a particular action in order for this to work. See intents and intent filters for more details on implicit intents.

Also, it allows multiple apps to respond to the same action. This is to prevent breakage in your app when the creator of the other app decides to rename their class, or some such. With an implicit intent you do not provide a specific class to start, instead you specify an action that other apps can choose to act upon. The correct way to start an activity outside of your application is to use a Implicit intent. Plus i don not know the package names for all.Īnyone knows how to overcome this please help. There must be a better solution than creating an if statement for every android phone flavor i the world. I found out that on droids with 2.2 does not work. I made the above so the when i touch the clock opens the alarm settings. Intent AlarmClockIntent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER).setComponent(new ComponentName("", "")) this worked on my htc magic with 1.5 and 1.6 tOnClickPendingIntent(R.id.Widget, pendingIntent) ĪppWidgetManager.getInstance(context).updateAppWidget(intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS), views) PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, AlarmClockIntent, 0) RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget)

this is the code: //this worked on my nexus 2.1 I want the user to touch the clock and launch the clock app on the phone. I am facing a problem with a clock widget i made.
