从通知打开其他应用程序

Open other App from Notification

是否可以通过通知启动另一个应用程序?例如用于拨打电话的本机应用程序。我的代码如下,但无法启动调用应用程序。

NotificationCompat.Builder mBuilder =
            new NotificationCompat.Builder(this)
                    .setSmallIcon(R.drawable.ic_call_white_24dp)
                    .setContentTitle("My notification")
                    .setContentText("Hello World!");

    Intent myIntent = new Intent(Intent.ACTION_CALL);
    myIntent.setData(Uri.parse("694154257"));      

    PendingIntent resultPendingIntent =
            PendingIntent.getActivity(
                    this,
                    0,
                    myIntent,
                    PendingIntent.FLAG_UPDATE_CURRENT
            );

    mBuilder.setContentIntent(resultPendingIntent).addAction(R.drawable.ic_call_white_24dp, "Make phone call", resultPendingIntent);
    NotificationManager mNotificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    // mId allows you to update the notification later on.
    mNotificationManager.notify(0, mBuilder.build());

你为什么不使用:

Intent myIntent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:694154257"));

顺便说一句,避免使用小于 1:

的通知 ID
mNotificationManager.notify(12, mBuilder.build());

更多信息:

Sending the User to Another App