中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

Android創(chuàng)建快捷方式以及刪除快捷方式

2018-07-20    來源:open-open

容器云強(qiáng)勢(shì)上線!快速搭建集群,上萬Linux鏡像隨意使用
/**
     *
     * 創(chuàng)建快捷方式
     * @param map 快捷方式圖標(biāo)
     * @param appName 快捷方式標(biāo)題
     * @param appUrl 快捷方式打開的地址
     * @param iconUrl 快捷方式圖標(biāo)地址
     *
     * */
    public static void createShortcut(Context activity ,Bitmap map ,String appName ,String appUrl ,String iconUrl){
        Intent shortcut = new Intent(
                "com.android.launcher.action.INSTALL_SHORTCUT");
        shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,appName);
        shortcut.putExtra("duplicate", false);// 設(shè)置是否重復(fù)創(chuàng)建
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_VIEW) ;
//      intent.addCategory(Intent.CATEGORY_LAUNCHER);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) ;
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK) ;
        intent.setClass(activity, WebViewActivity.class);// 設(shè)置第一個(gè)頁面
        intent.putExtra("keyword", appUrl);
        intent.putExtra("appName", appName) ;
        intent.putExtra("iconUrl", iconUrl) ;
        shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, intent);
        shortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON, map);
        activity.sendBroadcast(shortcut);      
    }
     
    /**
     *
     * 刪除快捷方式
     * @param shortcutName app名字
     * @param className 絕對(duì)路徑如:getPackageName() + ".WebViewActivity"
     *
     * */
    public static void removeShortcut(Context cxt, String shortcutName, String className) {
        Intent shortcutIntent = new Intent(Intent.ACTION_VIEW);
        shortcutIntent.setClassName(cxt, className);
        Intent intent = new Intent("com.android.launcher.action.UNINSTALL_SHORTCUT");
        intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
        intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, shortcutName);
        cxt.sendBroadcast(intent);
    }

標(biāo)簽:

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請(qǐng)聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點(diǎn)!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請(qǐng)與原作者聯(lián)系。

上一篇:php 日歷類 日歷控件

下一篇:PHP獲取客戶端IP地址函數(shù)(兼容多種情況)