Hack Forums
[C#] XAMARIN Android Simple code to hide app icon from luncher - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C#] XAMARIN Android Simple code to hide app icon from luncher (/showthread.php?tid=5441813)



XAMARIN Android Simple code to hide app icon from luncher - itcorp - Oct 23, 2016

Code that can be used for rat's for android or some hidden app's :)
pastebin[.]com/uHX5Ecp1

Code
//Hide
APPHide.SharedAPPHide().HideAppIcon(Application.Context, typeof(MainActivity));

//Show
APPHide.SharedAPPHide().UnHideAppIcon(Application.Context, typeof(MainActivity));

Code
using System;
using Android.Content.PM;
using Android.App.Admin;
using Android.App;
using Android.Content;
using Android;
using Android.OS;
using Android.Media;

namespace Core.Hidden
{
    /// <summary>
    /// ###############################################################################
    /// Hide App Icon from launcher
    /// ###############################################################################
    /// Contains:
    /// -------------------------------------------------------------------------------
    /// - HideAppIcon
    /// - UnHideAppIcon
    /// ###############################################################################
    /// </summary>
    public class APPHide
    {
        #region Hide app icon

        public void HideAppIcon(Context app_context,Type TP)
        {
            PackageManager p=app_context.PackageManager;

            ComponentName componentName = new ComponentName(app_context,Java.Lang.Class.FromType(TP));

            p.SetComponentEnabledSetting(componentName,ComponentEnabledState.Disabled,ComponentEnableOption.DontKillApp);
        }

        

        #endregion End

        #region Unhide app icon

        public void UnHideAppIcon(Context app_context,Type TP)
        {
            PackageManager p=app_context.PackageManager;

            ComponentName componentName = new ComponentName(app_context,Java.Lang.Class.FromType(TP));

            p.SetComponentEnabledSetting(componentName,ComponentEnabledState.Enabled,ComponentEnableOption.DontKillApp);
        }

        #endregion End
    
        #region Singleton pattern
        private static APPHide instance;
        private APPHide()
        {
            
        }
        public static APPHide SharedAPPHide()
        {
            if (instance == null)
                instance = new APPHide();
            return instance;
        }
        #endregion
    }
}