Add a shortcut to the Android home screen in the Ionic Cordova application

I am writing an ionic application for android (using coffeescript and angular) and I want to add a shortcut to the application on the home screen. Google did not help, this cordova/phonegap plugin also Not working properly.

Any ideas how to do it?

Starting from ICS, you can do this:

< /p>

public void createShortCut(){
Intent shortcutintent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
shortcutintent.putExtra("duplicate", false);
shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.shortcutname));
Parcelable icon = Intent.ShortcutIconResource.fromContext(getApplicationContext, R.drawable.icon);
shortcutintent. putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);
shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(getApplicationContext, EnterActivity.class));
sendBroadcast(shortcutintent);
)

You can also add permissions in AndroidManifest.xml, as shown below:

 android:name="com.android.launcher. permission.INSTALL_SHORTCUT" />
android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />

Please also refer to the source code of the launcher: this link

I am writing an ionic application for android (using coffeescript and angular), I I want to add a shortcut to the application on the home screen. Google didn’t help, and this cordova/phonegap plugin doesn’t work.

Any ideas how to do it?

Starting from ICS, you can do this:

public void createShortCut(){ 
Intent shortcutintent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
shortcutintent.putExtra("duplicate", false);
shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.shortcutname));
Parcelable icon = Intent.ShortcutIconResource.fromContext(getApplicationContext, R.drawable.icon);
shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);
shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(getApplicationContext, EnterActivity.class));
sendBroadcast(shortcutintent);
)

You can also add permissions in AndroidManifest.xml , As follows:

 android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />

Please also refer to the source code of the launcher: this link

< p>

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3781 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.