0

I am a new developer in android. I write a program with Main Activity that has 2 broadcastReceiver and 1 service. My app has an Icon, and I want to hide my launcher app icon from user and I want my app running in background. I saw here, but when I remove Activity segment, got errors. My manifest file:

<?xml version="1.0" encoding="utf-8"?>

<uses-sdk
    android:minSdkVersion="15"
    android:targetSdkVersion="19" />

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
 <uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" android:maxSdkVersion="19"/>
 <uses-permission android:maxSdkVersion="18" android:name="android.permission.INTERNET"/>
 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" android:maxSdkVersion="18"/>
 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" android:maxSdkVersion="18"/>

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.ray.MainActivity"
        android:label="@string/app_name" >
     <intent-filter>
            <action android:name="android.intent.action.MAIN" />

              <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>



    <service
        android:name=".LocalWordService"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
    </service>


    <receiver android:name=".MyScheduleReceiver" android:exported="true" >
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
    </receiver>

    <receiver android:name=".MyStartServiceReceiver" >
    </receiver>


</application>

Community
  • 1
  • 1
Gohar
  • 121
  • 3
  • 8

1 Answers1

4

Can't be done. A newly installed app is in the stopped state. The only way to turn it on is to run an Activity in the app manually. This is a security feature in Android. This means no services and no broadcast receivers will be run until at least 1 activity has been launched. Which means you need an Activity in the launcher. Which means it will appear in the app list.

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
  • then, Doesn't [this solution](http://stackoverflow.com/questions/14204720/android-hidden-application) work? – Gohar Jun 24 '14 at 05:36
  • Not on 3.0+. The BroadcastReceiver will be stopped and won't fire until an activity in the app has been manually run. – Gabe Sechan Jun 24 '14 at 06:08