0
是否可以从通知中启动另一个应用程序?例如用于拨打电话的本机应用程序。我的代码是followng,但无法启动调用应用程序。从通知中打开其他应用程序
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());