Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application without app icon

Tags:

android

I plan to do an app which contains only one activity and without any app icon, where I need to open this activity by using the keypad. Say for example, whenever you dial 12345 my application activity should open without an app icon. Is this possible in Android? How?

like image 368
Jameskittu Avatar asked Jun 21 '11 13:06

Jameskittu


3 Answers

just Remove "category" Tag from manifest file

  <activity
        android:name="com.example.airplanemode.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category />
        </intent-filter>
    </activity>
like image 42
ajay Avatar answered Oct 20 '22 10:10

ajay


Just remove android.intent.category.LAUNCHER from your main Activity in AndroidManifest.xml

And you cannot open app by dialing *#*#12345#*#* because in order to do that you have to write a receiver for following action

<action android:name="android.provider.Telephony.SECRET_CODE" />

Then you can open your app by firing an Intent from that broadcast receiver. But android does not permit this until your app is *System app.*

Following is the code that will help you Change activity in Manifest to have no intent filters like

<activity
            android:name=".MyApp"
            android:label="@string/title_activity_parent_trap"
            android:theme="@android:style/Theme.Holo" >
        </activity>
<receiver android:name=".MyApp$Launch" >
            <intent-filter>
                <action android:name="android.provider.Telephony.SECRET_CODE" />

                <data
                    android:host="(secret code)"
                    android:scheme="android_secret_code" />
            </intent-filter>
        </receiver>

Once done, make a class (I made the Launch class in my main class, extending BroadCast Receiver), then in the onReceive class, fire an intent to launch the activity.

Then typing *#*#(secret code)#*#* into the dialer will launch the app.

like image 200
VishalKale Avatar answered Oct 20 '22 12:10

VishalKale


You must specify drawable resource for android:icon attribute in application element of AndroidManifest.xml. From documentation:

This attribute must be set as a reference to a drawable resource containing the image (for example "@drawable/icon"). There is no default icon.


But the drawable specified doesn't need to be an icon. It can be defined as color in your resources:

<?xml version="1.0" encoding="utf-8"?>
<resources>
   <drawable name="color_icon">#ff0000</drawable>
</resources>

And then specify it in your AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest ...>  
    <application android:icon="@drawable/color_icon" ...>
       ...
    </application>  
</manifest> 

And you'll see something like this in your application launchpad:

enter image description here

like image 38
inazaruk Avatar answered Oct 20 '22 10:10

inazaruk