首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何读取Adb Dumpsys报警输出

如何读取Adb Dumpsys报警输出
EN

Stack Overflow用户
提问于 2017-01-31 01:46:46
回答 1查看 969关注 0票数 1

我通过闹钟管理器设置了多个闹钟,它们在设置当天工作得很好,但根本不会重复。我已经使用了一些链接来了解输出,但没有一个链接指定如何检查设置的闹钟的确切时间。这是我的输出

我设置闹钟的主代码

代码语言:javascript
复制
 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));

这是广播接收器

代码语言:javascript
复制
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
       } 
EN

回答 1

Stack Overflow用户

发布于 2017-07-06 17:52:08

也许它能对你有所帮助,我已经创建了一个开源项目,其中包含一个GUI版本的"adb shell dumpsys alarms“命令。你可以在这里找到它:

https://github.com/Dottorhouse/DumpsysAlarm

希望它能帮你找出哪里出了问题

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41942221

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档