Shortcut to start activity.

I have an application that creates a shortcut as follows:

Intent shortcutIntent = new Intent(this, MYWEBVIEW.class);
String fileHtml = trovaHtml(path);
shortcutIntent.putExtra("appToLaunch", appId);
shortcutIntent.putExtra("fileHtml", fileHtml);
shortcutIntent.setAction(Intent.ACTION_VIEW);

Intent addIntent = new Intent();
addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, dirAppName);
addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
    Intent.ShortcutIconResource.fromContext(this, R.drawable.icon));
addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
this.sendBroadcast(addIntent);

I know this code is outdated, but let it forget about it .......

MYWEBVIEW is not the main activity of my application, it is a web view that opens a standalone html page, and the path to this html file is in the additional value "fileHtml".

When I click on the shortcut, I get this error:

08-08 14: 15: 37.907: ERROR/Launcher (165): Launcher Intent {act = android.intent.action.VIEW flg = 0x10000000 cmp = market.finestraprincipale/.MyAppActivity bnds = [3,217] [77,296] ( )}. - . tag = ShortcutInfo (title= myFile) intent = Intent {act = android.intent.action.VIEW flg = 0x10000000 cmp = market.finestraprincipale/.MYWEBVIEW bnds = [3,217] [77,296] ( )}

08-08 14: 15: 37.907: ERROR/Launcher (165): java.lang.SecurityException: : Intent {act = android.intent.action.VIEW flg = 0x10000000 cmp = market.finestraprincipale/. MYWEBVIEW bnds = [3,217] [77,296] ( )} ProcessRecord {405875c8 165: com.android.launcher/10026} (pid = 165, uid = 10026) null

? ?

, , , "", , , MYWEBVIEW, .....so - .

+5
2

manifest.xml?

 <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />

, , , :

<intent-filter>
  <action android:name="android.intent.action.MAIN" />
</intent-filter>
+7

,        MYWEBVIEW . .

0

All Articles