身份證讀卡器安卓SDK在安卓12版本targetSdkVersion=32報(bào)錯(cuò)解決
之前的身份證讀卡器安卓SDK版本V1.0.40在安卓12版本,targetSdkVersion=32的時(shí)候會(huì)出現(xiàn)以下錯(cuò)誤:
Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
解決方法:
1、將項(xiàng)目的targetSdkVersion由31改為30
2、如果不想改targetSdkVersion,那就在在創(chuàng)建PendingIntent的時(shí)候判斷當(dāng)前系統(tǒng)版本,根據(jù)不同系統(tǒng)版本創(chuàng)建帶有不同flag的PendingIntent,具體代碼實(shí)現(xiàn)如下:
按如下方式修改DonseeDervice.arr代碼,更新至版本V1.0.41即可在安卓12版本使用。
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
mPendingIntent = PendingIntent.getBroadcast(mContext, 0, new Intent(ACTION_USB_PERMISSION), PendingIntent.FLAG_IMMUTABLE);
}else {
mPendingIntent = PendingIntent.getBroadcast(mContext, 0, new Intent(ACTION_USB_PERMISSION), 0);
}
- 東信智能身份證閱讀器&社保卡讀卡器萬能錄入軟件下載
- 重慶巴南使用社??ㄗx卡器打造社保卡“一卡通”示范社區(qū)
- 東信公司2025年清明節(jié)放假通知
- 多功能護(hù)照閱讀器采集登記管理系統(tǒng)
- MIFARE Ultralight AES卡是什么卡,支持的讀卡器有哪些?
- Mifare Ultralight C卡是什么卡
- NTAG213/NTAG215/NTAG216卡是什么卡
- MIFARE UltraLight卡(M0卡)是什么卡
- 東信公司2025年春節(jié)放假通知
- 人社部印發(fā)《關(guān)于加快推進(jìn)社會(huì)保障卡居民服務(wù)“一卡通”建設(shè)的通知》 社