【问题标题】:Impossible to read gmail notification无法阅读 gmail 通知
【发布时间】:2014-11-14 18:34:35
【问题描述】:

我正在使用通知侦听器 api 来读取通知信息,但似乎无法读取 Gmail 通知的文本。这是 adb 所说的:

extras={
        android.title=john
        android.support.actionExtras={0=Bundle[EMPTY_PARCEL], 1=Bundle[EMPTY_PARCEL]}
        android.subText=bar@gmail.com
        android.showChronometer=false
        android.icon=2130837727
        android.text=MyText
        android.progress=0
        android.progressMax=0
        android.showWhen=true
        android.people=[Ljava.lang.String;@b1564718 {
          mailto:foo@gmail.com
        }
        android.largeIcon=android.graphics.Bitmap@b15c6130 (128x128)
        android.infoText=null
        android.wearable.EXTENSIONS=Bundle[mParcelledData.dataSize=1200]
        android.progressIndeterminate=false
        android.scoreModified=false
      }

使用其他通知它可以工作。有小费吗?我正在以这种方式阅读通知:

String text = extras.getString(Notification.EXTRA_TEXT);

【问题讨论】:

    标签: android notifications gmail


    【解决方案1】:

    好的,问题解决了。有关通知的信息存储为 CharSequence,因此您必须使用getCharSequence() 获取它。由于 String 实现了 CharSequence 接口,因此它可能会起作用,但并非总是如此。但是使用 CharSequence 它可以工作。

    【讨论】:

      猜你喜欢
      • 2017-10-05
      • 2020-06-16
      • 2011-05-27
      • 1970-01-01
      • 2016-10-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多