Android 8.0 Shortcuts 點擊時報錯:未安裝該應用

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>
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容

  • Android 自定義View的各種姿勢1 Activity的顯示之ViewRootImpl詳解 Activity...
    passiontim閱讀 173,150評論 25 708
  • 用兩張圖告訴你,為什么你的 App 會卡頓? - Android - 掘金 Cover 有什么料? 從這篇文章中你...
    hw1212閱讀 12,897評論 2 59
  • 1、通過CocoaPods安裝項目名稱項目信息 AFNetworking網絡請求組件 FMDB本地數據庫組件 SD...
    陽明AGI閱讀 16,008評論 3 119
  • 本來人就比較內向,現在更是喜歡一個人獨處,一個人的時候一點也不寂寞,觀察內心,觀察思維,好玩的很呢。這里面有整個世...
    行進中的路人甲閱讀 100評論 0 0
  • 昨天晚上,隨意寫了篇《在這座城市里,曾經住過這些人》,蘆墟朱映茵阿姨留言,寫了很多文字。 與朱阿姨...
    黃葉村人閱讀 969評論 4 3