I am developing an application in which the requirement is hide app icon after installation.Means app icon will never display any where in home screen. I will launch app by using shortcode. Below code for hiding app ico.
ComponentName componentToDisable = new ComponentName(context, Splash.class);
context.getPackageManager().setComponentEnabledSetting(componentToDisable,PackageManager.COMPONENT_ENABLED_STATE_DISABLED,PackageManager.DONT_KILL_APP);
But my question is
how can i call above line of code just after installation of my application.
How I will identify that my application is just installed.
I have added below broadcast in menifest file
<receiver android:name=".utilities.InstallApplicationReceiver" >
<intent-filter>
<action android:name="android.intent.action.PACKAGE_ADDED" />
</intent-filter>
</receiver>
below is my bradcast class
public class InstallApplicationReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equalsIgnoreCase("android.intent.action.PACKAGE_ADDED")) {
ComponentName componentToDisable = new ComponentName(context, Splash.class);
context.getPackageManager().setComponentEnabledSetting(componentToDisable, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
}
}
}
but still its not hiding app icon :(