Thursday, 8 August 2013

How to make shortcut(icon) that every times request again on android homeScreen

How to make shortcut(icon) that every times request again on android
homeScreen

source as below..
private void makeShordtCut()
{
Bitmap icon = BitmapFactory.decodeResource(getResources(),
R.drawable.ic_launcher);
Intent shortcutIntent = new Intent(Intent.ACTION_VIEW);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
// shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
//shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
// shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
String goPage =
"http://ss.com?id=9&random=12312432354;//System.getcurrent....()
Uri myUri = Uri.parse(goPage);
shortcutIntent.setData(myUri);
Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "asdfgggg");
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, icon);
intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
intent.putExtra("duplicate", false);
if (icon != null)
{
sendBroadcast(intent);
}
}
Only first time working. May be android web-browser do not request again
when same page(sameUrl and same parameter).
Aleady, I add random value(system time). But this value also fixed. so,
not working
Aleady, I add 'Intent flag' but not working.
How to make shortcut that every time request to server again.

No comments:

Post a Comment