扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
private void startNotification(){ String ns = Context.NOTIFICATION_SERVICE; NotificationManager notificationManager = (NotificationManager) getSystemService(ns); Notification notification = new Notification(R.drawable.ic_launcher, null, System.currentTimeMillis()); RemoteViews notificationView = new RemoteViews(getPackageName(), R.layout.mynotification); //the intent that is started when the notification is clicked (works) Intent notificationIntent = new Intent(this, FlashLight.class); PendingIntent pendingNotificationIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); notification.contentView = notificationView; notification.contentIntent = pendingNotificationIntent; notification.flags |= Notification.FLAG_NO_CLEAR; //this is the intent that is supposed to be called when the //button is clicked Intent switchIntent = new Intent(this, switchButtonListener.class); PendingIntent pendingSwitchIntent = PendingIntent.getBroadcast(this, 0, switchIntent, 0); notificationView.setOnClickPendingIntent(R.id.closeOnFlash, pendingSwitchIntent); notificationManager.notify(1, notification);} public static class switchButtonListener extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Log.d("Here", "I am here"); FlashOnOff flashLight; flashLight = new FlashOnOff(); flashLight.flashLightOff(); flashLight.releaseCamera(); }}
and my xml:
成都创新互联公司是一家集网站建设,天峨企业网站建设,天峨品牌网站建设,网站定制,天峨网站建设报价,网络营销,网络优化,天峨网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。
In manefest under Application tag:
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流