android7.1新特性
image.png
公司項目在一段時間后發現這個功能突然不能用了,點擊時toast提示“未安裝該應用”,
解決方案如下:
發現是 android:targetClass和android:targetPackage配置問題
<shortcut
android:enabled="true"
android:icon="@drawable/qrcode"
android:shortcutDisabledMessage="@string/shortcut_disable"
android:shortcutId="scan"
android:shortcutLongLabel="@string/shortcut_scan_long"
android:shortcutShortLabel="@string/scan">
<intent
android:action="android.intent.action.VIEW"
android:targetClass="com.xxxxxx.android.main.qrcode.QRCodeScanActivity"http://這里配置正常的包名
android:targetPackage="com.xxxxxx.applicationId" />//這里要配置applicationId
<categories android:name="android.shortcut.conversation" />
</shortcut>