【发布时间】:2014-11-04 08:19:47
【问题描述】:
我正在尝试调用此方法`或更重要的是,当我按下 addAction 按钮时会调用一个数字。
public void call(){
Log.i(TAG,"Attempting Call "+emergecyNumber);
Intent callIntent = new Intent(Intent.ACTION_CALL);
//callIntent.setData(Uri.parse("tel:" +emergecyNumber));
startActivity(callIntent);
}`
我的通知
public void startFallNotification(String name, String loc){
Intent intent = new Intent(); //create intent for notifcation PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0); Notification noti = new Notification.Builder(this) .setVibrate(new long[]{1000,1000,1000,1000,1000}) //sets vibrate .setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)) //sets sound .setTicker(name+" has fallen at "+loc) .setContentTitle(name+" has fallen at "+loc) .setContentText(n+" has fallen") .setSmallIcon(R.drawable.ic_launcher) .addAction(R.drawable.ic_launcher, "Call Now", null) .setContentIntent(pIntent).getNotification(); NotificationManager notiMan = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); notiMan.notify(0,noti); }
【问题讨论】:
-
您是否尝试在通知点击时调用该方法?指定您的调用层次结构和流程。
-
我的主要目标是当有事情发生时,我会收到通知,通知中有一个按钮可以拨打电话。
标签: android android-intent notifications android-pendingintent