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());