在三星S4中,当我们点击通知时,应用程序无法打开

 月舞B的啊 发布于 2023-02-13 12:10

在我的应用程序中,我向设备发送GCM通知,当我们点击通知时,它不是在三星S4中打开应用程序.请任何人帮助我.

码:

    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    Notification notification = new Notification(icon, message, when);

    Intent notificationIntent = new Intent(context, Main.class);

    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
            | Intent.FLAG_ACTIVITY_SINGLE_TOP);

    PendingIntent intent = PendingIntent.getActivity(context, 0,
            notificationIntent, 0);
    String title = context.getString(R.string.app_name);
    notification.setLatestEventInfo(context, title, message, intent);
    notification.flags |= Notification.FLAG_AUTO_CANCEL;

    notification.defaults |= Notification.DEFAULT_SOUND;

    notification.defaults |= Notification.DEFAULT_VIBRATE;
    notificationManager.notify(0111, notification);

小智.. 6

android:exported="true"在AndroidManifest中添加intent指定的Activity.这个问题依赖于Android版而不是三星.......

1 个回答
  • android:exported="true"在AndroidManifest中添加intent指定的Activity.这个问题依赖于Android版而不是三星.......

    2023-02-13 12:12 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有