0

is it possible to ask website visitors to save your website on their home-screen? android

guy ribak
  • 125
  • 1
  • 1
  • 8
  • don't think there is otherwise you could just spam people's phones http://stackoverflow.com/questions/1141979/javascript-for-add-to-home-screen-on-iphone – Pete Dec 08 '15 at 14:03

1 Answers1

0

Check out this answer here, on how to create a shortcut:

How to add android bookmark on homescreen from web page?

If you're writing an Android app, you can use this approach. However, if this is a website, this approach will not work, as it looks like the Android Intent system ignores website generated actions.


you can create a web page shortcut on home screen using this code. Provide the necessary info like url, title etc..

final Intent in = new Intent();
  final Intent shortcutIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
  long urlHash = url.hashCode();
  long uniqueId = (urlHash << 32) | shortcutIntent.hashCode();
  shortcutIntent.putExtra(Browser.EXTRA_APPLICATION_ID, Long.toString(uniqueId));
  in.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
  in.putExtra(Intent.EXTRA_SHORTCUT_NAME, title);
  in.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
                    Intent.ShortcutIconResource.fromContext(
                            BrowserBookmarksPage.this,
                            R.drawable.ic_launcher_shortcut_browser_bookmark));
  in.setAction("com.android.launcher.action.INSTALL_SHORTCUT"); 
//or   in.setAction(Intent.ACTION_CREATE_SHORTCUT); 

  sendBroadcast(in);
Community
  • 1
  • 1
FoxDeploy
  • 12,569
  • 2
  • 33
  • 48