Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid - App makes shortcut with App's name, not Intent.EXTRA_SHORTCUT_NAME
    text
    copied!<p>This was working fine earlier, but now it apparentally doesn't. Here's my code:</p> <pre><code>if (options[item].equals("Add to Home Screen")) { Intent shortcutIntent = new Intent(); shortcutIntent.setClassName("net.dylang.android.system_sounds_pro", "net.dylang.android.system_sounds_pro.SystemSounds"); shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); shortcutIntent.putExtra("profileName", SystemSounds.prop.getProperty(((String) button.getText()).replaceAll(" ", "-"))); shortcutIntent.putExtra("profileText", button.getText()); if (SystemSounds.prop.getProperty("vibrated-ringers").contains(((String) button.getText()).replaceAll(" ", "-"))) shortcutIntent.putExtra("vibratedringsi", "true"); else shortcutIntent.putExtra("vibratedringsi", "false"); if (SystemSounds.prop.getProperty("vibrated-notifications").contains(((String) button.getText()).replaceAll(" ", "-"))) shortcutIntent.putExtra("vibratednotsi", "true"); else shortcutIntent.putExtra("vibratednotsi", "false"); Intent addIntent = new Intent(); Toast.makeText(getApplicationContext(), shortcutIntent.getStringExtra("profileText"), 0).show(); addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent); addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, shortcutIntent.getStringExtra("profileText")); addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(ProfilesPage.this, R.drawable.icon)); addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT"); ProfilesPage.this.sendBroadcast(addIntent); } </code></pre> <p>My Toast shows the correct shortcut name, but when I add it to the homescreen it's my app's name.</p> <p>Thanks,</p> <p>DylanG</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload