How to create a mobile desktop shortcut for a Web App?

Asked

Viewed 2,591 times

-1

I have a web app ready and published.

There is the possibility to create a web app icon on the Desktop of iOS and Android Systems automatically or at least through a confirmation question?

I hope I have been clear, because this issue even Google did not understand...

Only one addendum: Creating a simple app with only a text box and a button, where I typed a URL and the button triggered an event to create the shortcut would solve my problem!

  • You want to detect if the browser is Ios or Android and in this case display an icon? I understand correct?

  • Sergio, regardless of the operating system (iOS or Android) and browser (Chrome, Opera, etc), I need that once the URL is accessed, automatically create an icon on the desktop.

3 answers

1

1-Create Function to call Intent of shortcut:

private void criarAtalho() {
    Intent shortcutIntent = new Intent(getApplicationContext(), 
        SplashScreen.class);
    shortcutIntent.setAction(Intent.ACTION_MAIN);
    Intent addIntent = new Intent();
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "nomeDaApp");
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, 
        Intent.ShortcutIconResource.fromContext(getApplicationContext(), 
            R.mipmap.ic_launcher));

    addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
    addIntent.putExtra("duplicate", false);  //may it's already there so don't duplicate
    getApplicationContext().sendBroadcast(addIntent);
}

2-write on Oncreat the call of Function:

if(!getSharedPreferences("APP_PREFERENCE", Activity.MODE_PRIVATE).
    getBoolean("IS_ICON_CREATED", false)){

    criarAtalho();
    getSharedPreferences("APP_PREFERENCE", Activity.MODE_PRIVATE).
        edit().putBoolean("IS_ICON_CREATED", true).commit();
}

3-set the Permissions on manifest:

<uses-permission
android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
  • Pedro, just below your question there is the link edit, use it to change your question and include the text you entered in these comments there.

1

You can use the following tags

<link rel="apple-touch-icon" sizes="57x57" href="http://arpadesign.com.br/img/logo_touch_57x57.png"/>
<link rel="apple-touch-icon" sizes="72x72" href="http://arpadesign.com.br/img/logo_touch_72x72.png"/>
<link rel="apple-touch-icon" sizes="114x114" href="http://arpadesign.com.br/img/logo_touch_114x114.png"/>

<link rel="apple-touch-icon-precomposed" sizes="57x57" href="http://arpadesign.com.br/img/logo_touch_57x57.png"/>
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="http://arpadesign.com.br/img/logo_touch_72x72.png"/>
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="http://arpadesign.com.br/img/logo_touch_114x114.png"/>

<link rel="apple-touch-startup-image" href="http://arpadesign.com.br/img/logo_touch.png">

<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />

0

You should have the apps posted in the App Store and Googleplay stores!

As you already have the application ready on the Web, one option would be to develop the applications for IOS and Android with the only function of loading the web page.

And on your page make a check if the user is on a mobile device and suggest to download the app!

But you need to check that Google and Apple are accepting this!

This is because creating a direct shortcut is not yet possible.

  • 1

    Can you explain why the -1 in the answer!

  • Well didn’t explain but I went to find out and got a guy to help you! You’re welcome!

  • Vinicius, I didn’t send this -1 (I think, because I’m new on the site, I can’t do it). Anyway, I thank you... Unfortunately, I have already discovered that what I wanted cannot be done at all! Hugs, Alexandre

  • Maravilha Alexandre. Even with these tags, because I also did not know that I could put a shortcut on IOS and Android, for a web page, and with these tags is possible, but beauty, I thought it was you, and had not understood the reason, but as it was not wrong.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.