Showing posts with label broadcast receiver. Show all posts
Showing posts with label broadcast receiver. Show all posts

Sunday, November 09, 2014

Fundamentals of Android Programming - 26-30 Jan 2015 (OSLO, NORWAY)

In collaboration with ProgramUtvikling, I will be teaching the Fundamentals of Android Programming course on the 26 - 30 Jan 2015 in Oslo, Norway. This is a 5-day course that teaches the fundamentals of Android programming, such as Activities, Intents, Broadcast and Broadcast Receivers, Networking, Notifications (local and remote), Data Storage, and more. If you and your team are interest to get into Android development, this course provides the most cost effective way to get started!


What's more, this course will be taught using Google's latest IDE - Android Studio. For this course, you will get a lab-intensive workbook that illustrates the many important concepts of building an Android app.

Monday, March 31, 2014

Android Tip - Hide App Icon in Launcher

You may have an application that contains a broadcast receiver and for some reasons you want to hide the application icon in the Launcher after it has been installed (so that the user doesn’t know the app existed).

Programmatically Hiding the Icon


If you want the application icon to be visible after installation and hide it programmatically afterwards, you can use the following code snippets:

    PackageManager p = getPackageManager();
    p.setComponentEnabledSetting(getComponentName(),
        PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
        PackageManager.DONT_KILL_APP);
   
When the above statements are executed, the application icon in the Launcher will disappear after a while.

Declaratively Hiding the Icon

The easist way to hide your application icon from the Launcher is to remove the android.intent.category.LAUNCHER category from your app’s AndroidManifest.xml file. However, simply doing so will also render your broadcast receiver useless – it won’t respond to your broadcasts.

To fix this, you need to also add in the android.intent.category.DEFAULT category, like this:

        <activity
            android:name=
            "net.learn2develop.locationmonitor.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name=
                    "android.intent.action.MAIN" />                              
                <category android:name=
                    "android.intent.category.DEFAULT" />
               
                <!—
                <category android:name=
                    "android.intent.category.LAUNCHER" />
                -->
            </intent-filter>
        </activity>


The application icon will then no longer appear in the Launcher.