0

I have below code which work perfect in android devices but not in Nokia-x

Here is the sample code:

Intent shortcutIntent = new Intent(getApplicationContext(), MainActivity.class);
                shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

                Intent addIntent = new Intent();
                addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
                addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "Icon Test");
                addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(getApplicationContext(), R.drawable.ic_launcher));
                addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
                getApplicationContext().sendBroadcast(addIntent);

Please help me out in achieving same thing in Nokia-x

Kapil
  • 1,790
  • 1
  • 16
  • 32
  • That code does not "work perfect in all android devices". It will only work on devices with an app that listens to that broadcast, where that app is the user's current home screen implementation. There is no requirement for any home screen implementation to honor that broadcast. – CommonsWare Jun 05 '14 at 12:45
  • Commonsware!! It was just for sample. In my project, i create icon so that this icon can open a direct link in browser. Please remove downvote or you can help me by editing the question if you like. – Kapil Jun 05 '14 at 13:06
  • I didn't downvote your question. Please re-read my comment. – CommonsWare Jun 05 '14 at 13:15

2 Answers2

1

As already identified the Nokia X application launcher does not listen that broadcast, also the launcher idea is a bit different than with other AOSP devices, and would not see the design very well suited for shortcut icons.

anyway, the Fastlane is showing all notifications, thus if you want to make a shortcut to a task, then with Nokia X you should use the Notifications for the task.

Dr.Jukka
  • 2,346
  • 2
  • 15
  • 20
0

Actually Nokia X doesn't have home screen, what it has is app launcher(tiles). Even notifications pane known as fastlane. Your code works with home screen on launchers like Nova Launcher. Even I am using Nova Launcher on my Nokia X.

JabberwockyDecompiler
  • 3,318
  • 2
  • 42
  • 54