<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Imran khan</title>
    <description>The latest articles on DEV Community by Imran khan (@imrankhanluhar).</description>
    <link>https://dev.to/imrankhanluhar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F232621%2Ff2e4b3ab-afda-4cd4-9cb8-918d8755612a.jpeg</url>
      <title>DEV Community: Imran khan</title>
      <link>https://dev.to/imrankhanluhar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/imrankhanluhar"/>
    <language>en</language>
    <item>
      <title>Activity ShortCut is not create in Vivo devices</title>
      <dc:creator>Imran khan</dc:creator>
      <pubDate>Thu, 19 Sep 2019 10:02:36 +0000</pubDate>
      <link>https://dev.to/imrankhanluhar/activity-shortcut-is-not-create-in-vivo-devices-3m29</link>
      <guid>https://dev.to/imrankhanluhar/activity-shortcut-is-not-create-in-vivo-devices-3m29</guid>
      <description>&lt;p&gt;I want to create the Activity shortcut at home screen , so user can open the activity screen directly .&lt;/p&gt;

&lt;p&gt;I have used this code&lt;/p&gt;

&lt;p&gt;if(ShortcutManagerCompat.isRequestPinShortcutSupported&lt;br&gt;
    (getApplicationContext()))&lt;br&gt;
    {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    ShortcutInfoCompat shortcut = new ShortcutInfoCompat.Builder(getApplicationContext(), id)
     .setIntent(new Intent(getApplicationContext(), 
       TranslateActivity.class).setAction(Intent.ACTION_MAIN))
     .setShortLabel(label)
     .setIcon(icon)
     .build();
     return 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;ShortcutManagerCompat.requestPinShortcut(getApplicationContext(), &lt;br&gt;
  shortcut, startHomeScreen());&lt;br&gt;
}&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; else
     {
    // Shortcut is not supported by your launcher

    Intent shortcutIntent = new Intent(getApplicationContext(), TranslateActivity.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, "Test");
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(getApplicationContext(), R.mipmap.ic_launcher));
    addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
    getApplicationContext().sendBroadcast(addIntent);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>android</category>
      <category>java</category>
      <category>shortcut</category>
      <category>vivodevices</category>
    </item>
  </channel>
</rss>
