什么可以在通知栏中生成 XML 布局文件?

What could produce the XML Layout file in notification bar?

我遇到了一个非常奇怪的问题。

我正在构建一个 Android 应用程序,它使用信标来接收一些通知。问题是,除了我应该收到的通知外,我还收到了一个包含 XML 文件路径的通知(并非每次都相同)。在代码中,没有任何东西可以指向它。

您知道问题出在哪里吗?

信标代码

    public void onReceive(Context context, Intent intent) {

    mSharedPref = context.getSharedPreferences(context.getPackageName(),
            Context.MODE_PRIVATE);
    NotificationManager notificationManager = (NotificationManager) context
            .getSystemService(Context.NOTIFICATION_SERVICE);
    ArrayList<Coupon> coupons = intent
            .getParcelableArrayListExtra(OnyxBeaconApplication.EXTRA_COUPONS);

    if (coupons == null || coupons.size() == 0) {
    } else {
        String couponsListAsString = mSharedPref.getString(
                COUPONS_LIST_ENTRY, SHARED_PREF_NO_ENTRY);
        ArrayList<Coupon> couponsFromStorage = new ArrayList<Coupon>();
        ArrayList<Coupon> newCoupons = new ArrayList<Coupon>();
        if (!couponsListAsString.equals(SHARED_PREF_NO_ENTRY)) {
            couponsFromStorage = (ArrayList<Coupon>) gson.fromJson(
                    couponsListAsString, new TypeToken<List<Coupon>>() {
                    }.getType());
            for (Coupon couponReceived : coupons) {
                boolean couponFound = false;
                for (Coupon couponFromStorage : couponsFromStorage) {
                    if (couponReceived.couponId == couponFromStorage.couponId) {
                        couponFound = true;
                    }
                }
                if (!couponFound) {
                    newCoupons.add(couponReceived);
                }
            }
        }

        couponsFromStorage.addAll(newCoupons);

        SharedPreferences.Editor editor = mSharedPref.edit();
        editor.putString(COUPONS_LIST_ENTRY,
                gson.toJson(couponsFromStorage));
        editor.commit();

        mCouponCounter = mSharedPref.getInt(COUPONS_NEW_COUNTER, 0);
        TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
        Intent i = new Intent(context, MainActivity.class);
        i.putParcelableArrayListExtra(MainActivity.EXTRA_COUPONS, coupons);
        stackBuilder.addNextIntent(i);
        PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(
                0, PendingIntent.FLAG_UPDATE_CURRENT);

        Uri notificationSound = RingtoneManager
                .getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
        long[] vibratePattern = { 500, 500, 500, 500 };
        for (Iterator<Coupon> ci = coupons.iterator(); ci.hasNext();) {
            ++mCouponCounter;
            Coupon c = ci.next();
            NotificationCompat.Builder builder = new NotificationCompat.Builder(
                    context)
                    .setContentTitle(c.name)
                    .setContentText(c.message)
                    .setContentInfo(
                            mCouponCounter > 1 ? "+ "
                                    + (mCouponCounter - 1) + " new more"
                                    : "")
                    .setSmallIcon(R.drawable.ic_launcher)
                    .setAutoCancel(true).setGroup(COUPON_KEY)
                    .setGroupSummary(true).setVibrate(vibratePattern)
                    .setLights(Color.BLACK, 500, 500)
                    .setSound(notificationSound);

            builder.setContentIntent(resultPendingIntent);
            notificationManager.notify(COUPONS_TAG, 1, builder.build());

            editor.putInt(COUPONS_NEW_COUNTER, mCouponCounter);
            editor.commit();
        }

        if (mCouponListener != null) {
            mCouponListener.onCouponsReceived(coupons);
        }

    }
}

我解决了。原来这是他们库中的一个错误。他们还没有发布更新的图书馆,但他们给我发了一个新的。