0
이것은 내 홈 화면에 바로 가기를 만드는 코드입니다. 아무 것도 잘 작동하지만 홈 화면에서 바로 가기를 클릭하면 "설치되지 않은 앱"이 표시됩니다. 나는 그것을 수리하고 싶다.앱이 설치되지 않았습니다.
코드
appPref = getSharedPreferences("isFirstTime", 0);
isFirstTime = appPref.getBoolean("isFirstTime", true);
if (isFirstTime) {
// Create explicit intent which will be used to call Our application
// when some one clicked on short cut
Intent shortcutIntent = new Intent(getApplicationContext(),
MainActivity.class);
shortcutIntent.setAction(Intent.ACTION_MAIN);
Intent intent = new Intent();
// Create Implicit intent and assign Shortcut Application Name, Icon
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "Get Quote");
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
Intent.ShortcutIconResource.fromContext(
getApplicationContext(), R.drawable.ic_launcher));
intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
getApplicationContext().sendBroadcast(intent);
// Set preference to inform that we have created shortcut on
// Homescreen
SharedPreferences.Editor editor = appPref.edit();
editor.putBoolean("isFirstTime", false);
editor.commit();
}
}