2012-09-10 46 views
0

肌酸的應用程序圖標時,我想在手機屏幕上創建應用程序圖標,我做的,但是當我做自動應用程序創建敬酒消息,如何防止這種敬酒消息製作時應用程序圖標或刪除屏幕上的圖標? 謝謝。如何防止敬酒消息在屏幕上

也就是說代碼我如何做到這一點的添加快捷方式

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

回答

1

我覺得不能,因爲麪包是由發射出

private void addShortcut(){ 
Intent shortcutIntent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT"); 

// Shortcut name 
shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name)); 
shortcutIntent.putExtra("duplicate", false); 

ComponentName comp = new ComponentName(this.getPackageName(), "."+this.getLocalClassName()); 
shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(Intent.ACTION_MAIN).setComponent(comp)); 

// Shortcut icon 
ShortcutIconResource iconRes = Intent.ShortcutIconResource.fromContext(this, R.drawable.icon); 
shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, iconRes); 

sendBroadcast(shortcutIntent); 
} 


private void delShortcut(){ 
Intent shortcut = new Intent("com.android.launcher.action.UNINSTALL_SHORTCUT"); 

// Shortcut adı 
shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name)); 

String appClass = this.getPackageName() + "." +this.getLocalClassName(); 
ComponentName comp = new ComponentName(this.getPackageName(), appClass); 
shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, new Intent(Intent.ACTION_MAIN).setComponent(comp)); 

sendBroadcast(shortcut); 
} 


public void onCreate(Bundle savedInstanceState) { 
super.onCreate(savedInstanceState); 
setContentView(R.layout.main); 
delShortcut(); 
addShortcut(); 

權限,這是一個不同於你的應用程序。

雖然我可能是錯的。

無論如何,這不是您的應用程序創建的敬酒,所以它是不太可能的,你可以隱藏它。

+0

但是沒有烤麪包怎麼辦? –

+0

我不記得whatsapp把自己的快捷鍵。在哪些情況下會創建快捷方式?還有,你檢查過哪些發射器?也許別人會表示敬酒。我現在嘗試與某人進行對話並選擇創建聯繫人的快捷方式,並且我可以清楚地看到敬酒。我使用Nova Launcher。 –