根据本教程: NotificationListenerService,我试图在我的应用程序中实现,但是在调用getActiveNotifications时,我有一个NullPointerException。
Caused by: java.lang.NullPointerException
at android.os.Parcel.readException(Parcel.java:1437)
at android.os.Parcel.readException(Parcel.java:1385)
at android.app.INotificationManager$Stub$Proxy
我正在创建一个呼叫应用程序。
这是在Android4.0和5.0上工作的自动应答;而当我有来电应答按钮时,call按钮可以工作,但在Android6.0上不工作。
我测试了这篇文章的答案,但它也不起作用:
IncomingActivity:
@Override
public void onClick(View v) {
switch (v.getId())
{
case R.id.imgaccept:
{
if (Build.VERSION.SDK_INT >= 21) {
new T
public class ReadNotifications extends NotificationListenerService {
Context context;
@Override
public void onCreate() {
super.onCreate();
context = getApplicationContext();
}
@Override
public void onNotificationPosted(StatusBarNotification sbn) {
for