hello/hola How to hide my application?

Spanish: hola a todos, buenos dias, estoy hace un tiempo renegando con un problema.
mi problema es que construi una aplicacion con fcm en xamarin android... el asunto es que estoy necesitando que se oculte luego de la instalacion el icono de la aplicacion osea que este oculta cuando vamos al menu use este codigo:

 PackageManager p = this.PackageManager;
    ComponentName componentName = new ComponentName(this, Class);
    p.SetComponentEnabledSetting(componentName, ComponentEnabledState.Disabled, ComponentEnableOption.DontKillApp);

el problema fue que me mata la aplicacion luego de reiniciarla y todo eso.
luego probe este :
private void RemoveShortcut()
{
var shortcutIntent = new Intent(this, typeof(MainActivity));
shortcutIntent.SetAction(Intent.ActionMain);

        var intent = new Intent();
        intent.PutExtra(Intent.ExtraShortcutIntent, shortcutIntent);
        intent.PutExtra(Intent.ExtraShortcutName, System.IO.Path.GetExtension(ApplicationInfo.PackageName).TrimStart('.'));
        intent.SetAction("com.android.launcher.action.UNINSTALL_SHORTCUT");
        SendBroadcast(intent);
    }

pero este fragmento de codigo no realizo nada en mi aplicacion, tengo los permisos agregados en el manifest y todo no se me ocurre otra cosa.. en android studio es comentar una linea en el manifest el main.launcher y se oculta del menu la app pero sigue lo demas corriendo

ENGLISH:
Hello everyone, good morning, I was a while ago renegade with a problem.
my problem is that I built an application with fcm in xamarin android ... the issue is that I need to hide after the installation the icon of the application that is hidden when we go to the menu use this code:

PackageManager p = this.PackageManager;
ComponentName componentName = new ComponentName(this, Class);
p.SetComponentEnabledSetting(componentName, ComponentEnabledState.Disabled, ComponentEnableOption.DontKillApp);

The problem was that it kills the application after restarting it and all that.
then try this:
private void RemoveShortcut()
{
var shortcutIntent = new Intent(this, typeof(MainActivity));
shortcutIntent.SetAction(Intent.ActionMain);

        var intent = new Intent();
        intent.PutExtra(Intent.ExtraShortcutIntent, shortcutIntent);
        intent.PutExtra(Intent.ExtraShortcutName, System.IO.Path.GetExtension(ApplicationInfo.PackageName).TrimStart('.'));
        intent.SetAction("com.android.launcher.action.UNINSTALL_SHORTCUT");
        SendBroadcast(intent);
    }

but this code fragment did not do anything in my application, I have the permissions added in the manifest and everything else can not occur to me .. in android studio is to comment on a line in the main.launcher manifest and the app is hidden from the menu but follow the rest running

help :(

Answers

Sign In or Register to comment.