当前位置: 首页 > 知识库问答 >
问题:

如何读取Adb Dumpsys报警输出[副本]

袁阿苏
2023-03-14

我设置闹钟的主要代码

 final int _id = (int) System.currentTimeMillis();

        AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);

   //  alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,AllTime[i],AlarmManager.INTERVAL_DAY,
        //        PendingIntent.getBroadcast(this, _id, alertIntent, PendingIntent.FLAG_UPDATE_CURRENT));
        alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP,AllTime[i],AlarmManager.INTERVAL_DAY,
                PendingIntent.getBroadcast(this, _id, alertIntent, PendingIntent.FLAG_UPDATE_CURRENT));

这是广播接收器

public void onReceive(Context context, Intent intent) {


    String[] myStrings = intent.getStringArrayExtra("strings");
    Log.i("okk", "cathing intent values through break" + Arrays.toString(myStrings));


    createNotification(context, "Time is here baby", "this is the notification text", "Alert");
    Log.i("okk", "cathing intent values through break" + Arrays.toString(myStrings));


}

public void createNotification(Context context, String msg, String msgText, String msgAlert) {
    final int _id = (int) System.currentTimeMillis();  // unique request code

    // will open mainActivity on notification click, can change it
 //   PendingIntent notificationIntent = PendingIntent.getActivity(context, _id, new Intent(context, MainActivity.class), 0);  // changed from 0 to _id

    PendingIntent notificationIntent = PendingIntent.getActivity(context,0, new Intent(context,MainActivity.class),0);
    NotificationCompat.Builder mbuilder = new NotificationCompat.Builder(context)
            .setSmallIcon(R.drawable.cast_ic_notification_play)
            .setContentTitle(msg)
            .setTicker(msgAlert)
            .setContentText(msgText);

    // now intent we want to fire when noti is clicked

    mbuilder.setContentIntent(notificationIntent);

    // how person is notified

    mbuilder.setDefaults(NotificationCompat.DEFAULT_SOUND);

    mbuilder.setAutoCancel(true); // noti dismisble when user swipe it away

    NotificationManager notificationManager = (NotificationManager)
            context.getSystemService((Context.NOTIFICATION_SERVICE));

    //    Log.i("okk", "NOTIFIED " + intent.getExtras());

    notificationManager.notify(1, mbuilder.build());  // changes from 1 to _id
       } 

共有1个答案

穆展鹏
2023-03-14

也许它可以帮助您,我已经用“ADB shell dumpsys Alarms”命令的GUI版本创建了一个opensource项目。你可以在这里找到它:

https://github.com/dottorhouse/dumpsysalarm

希望它能帮你弄清楚出了什么问题

 类似资料:
  • 问题内容: 我有一个Java应用程序,该应用程序存在一些性能问题,有人建议我以verbose:gc模式运行它。这已经完成,但是我不知道如何解释日志记录。是否可以向我解释这一切的含义,或者为我提供提高性能的建议? 可以在以下位置找到输出日志:http : //pastebin.com/uDNPEGcd 在此先感谢您,马尔滕 问题答案: 在每个gc集合之后立即打印,并打印有关每个世代内存详细信息的详细

  • 问题内容: 我想制作一个Servlet过滤器,该过滤器将在处理和完成响应后读取响应的内容,并以XML或PDF或其他方式返回该信息。但是我不确定如何从HttpServletResponse对象中获取任何信息。我如何获得此信息? 问题答案: 将此添加到过滤器java文件。 使用以下代码: 现在,content变量具有输出流。您也可以对二进制内容执行此操作。

  • 我的列车数据集中有648个变量。编码时: python只输出前30个和后30个变量。我想知道所有变量的结果。

  • 问题内容: 我有以下代码: 试图从阅读器中读取内容已挂起。我该如何解决?我该如何寻找正在发生的事情? 问题答案: 在等待命令完成的同时,必须连续读取输出。否则,如果命令产生足够的输出以填充输出缓冲区,则该命令将挂起,等待缓冲区被消耗,这将永远不会发生。这样您就陷入僵局。 以下示例在监视命令状态的同时连续读取stdout和stderr。它基于官方的JSch 示例 (仅添加了stderr的阅读)。 如

  • 所以,以下是问题: > 挂起的警报批次:23 a.“23”是当前活动的、预定的警报吗? +47S271MS正在运行,0次唤醒,2次警报:com.username.weatherinfo  · act=com.username.receivers.cyclicweatherupdater.weather_update_action  · · CMP={com.username.weatherinfo

  • 问题内容: 我正在Ubuntu 11.4上的一个终端上运行它。 假设我执行一个bash脚本,输出为: 在同一个bash脚本中,如何将上述输出存储为一个或多个变量? 理想的解决方案是准备好在以下条件中使用:(输出的第一行将存储在等中) 问题答案: 所以你要 请参见Bash手册中的“此处字符串” 。 或流程替代