Launching the Xperia Z alarm clock

2019-08-25 19:49发布

问题:

I'm using this block of code to launch the default Alarm Clock when tapping on my clock widget.

public Intent getAlarmPackage(Context context)
{
    PackageManager packageManager = context.getPackageManager();
    Intent AlarmClockIntent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER);

    String clockImpls[][] = {
            { "Standard Alarm", "com.android.alarmclock",
                    "com.android.alarmclock.AlarmClock" },
            { "HTC Alarm ClockDT", "com.htc.android.worldclock",
                    "com.htc.android.worldclock.WorldClockTabControl" },
            { "Standard Alarm ClockDT", "com.android.deskclock",
                    "com.android.deskclock.AlarmClock" },
            { "Froyo Nexus Alarm ClockDT",
                    "com.google.android.deskclock",
                    "com.android.deskclock.DeskClock" },
            { "Moto Blur Alarm ClockDT",
                    "com.motorola.blur.alarmclock",
                    "com.motorola.blur.alarmclock.AlarmClock" },
            { "Samsung Galaxy S", "com.sec.android.app.clockpackage",
                    "com.sec.android.app.clockpackage.ClockPackage" } };

But this is not working with the Sony Xperia Z. Any suggestions?

回答1:

After some search i managed to find corresponding Activity:

{ "Sony Ericsson Xperia Z", "com.sonyericsson.organizer", "com.sonyericsson.organizer.Organizer_WorldClock" }   

As alternative com.sonyericsson.organizer also contains - com.sonyericsson.alarm.SetAlarm



回答2:

Organizer_WorldClock opens a world clock. To open a list of alarms is better to use just Organizer

{ "Sony Ericsson Xperia Z", "com.sonyericsson.organizer", "com.sonyericsson.organizer.Organizer" }