My android app is not being displayed in the app d

2019-01-20 10:42发布

I've made an sms application but when it's installed it does not appear on the app drawer (the bit where you launch applications from on the home screen)! I can confirm it is actually installed because i can launch it from intents from other programs and the icon/name even appears in 'manage applications' under settings! Once launched the whole app functions as it should (I even get the option to use it as default for sending sms!) so i don't think its anything to do with my java files, I have a feeling its something to do with my android manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.pearson.sms"
  android:versionCode="1"
  android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.SEND_SMS">
</uses-permission>
<uses-permission android:name="android.permission.RECEIVE_SMS">
</uses-permission>
<uses-permission android:name="android.permission.READ_SMS">
</uses-permission>
<uses-permission android:name="android.permission.WRITE_SMS">
</uses-permission>
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".DisplaySMSRecieved"
          android:label="@string/app_name">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
        <data android:scheme="sms" /> 
    </intent-filter>
    <intent-filter>
            <action android:name="com.pearson.sms.LAUNCH" />  
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
</activity>
<receiver android:name=".PearsonSMSReciever"> 
    <intent-filter> 
        <action android:name="android.provider.Telephony.SMS_RECEIVED" />
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="sms" /> 
    </intent-filter> 
</receiver>
<activity android:name=".PearsonSMS"
          android:label="@string/send_sms">
          <intent-filter>
        <action android:name="android.intent.action.SENDTO" />
        <action android:name="android.intent.action.VIEW" />  
        <category android:name="android.intent.category.DEFAULT" />
        <data android:scheme="sms"/> 
    </intent-filter>
  </activity>
 </application>
</manifest>

It's a bit of a mess as I was struggling to make it work as a proper sms application, but I can't see what I've done wrong to make it not list itself on the app drawer, please help!

EDIT: sorted it, it was the intent filter

<intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
        <data android:scheme="sms" /> 
    </intent-filter>

it shouldn't have the android:scheme in there, i changed it to

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

and it now gets listed in the app drawer :)

3条回答
迷人小祖宗
2楼-- · 2019-01-20 10:46

It's a long shot but is there an icon in the drawable folder? You have android:icon="@drawable/icon which tells Android what icon to use in the app drawer. Maybe try putting in your own icon. Also try uninstalling/reinstalling (maybe reboot phone also just to be sure) the app as I've noticed that Android will sometimes cache these icons.

UPDATE

What happens when you run it from eclipse and then hold down the HOME button (to get recent apps)? Does it show up there? Is there an icon?

查看更多
手持菜刀,她持情操
3楼-- · 2019-01-20 10:51

also, you can use double intent-filter like the following one inside your desired activity that uses data

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    <data android:scheme="sms" /> 
</intent-filter>
查看更多
Deceive 欺骗
4楼-- · 2019-01-20 11:07

You could try removing the data entry from your first intent filter for DisplaySMSRecieved. To appear on the launcher you need to have an intent filter like:

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

Make sure you have specified an icon and a name for your package so that it can be displayed in the list.

查看更多
登录 后发表回答