2017-09-24 161 views
2

當我添加意圖過濾器(爲了使Google抓取我的應用內容並允許用戶從搜索結果中輸入我的應用),我的應用仍然從我的Android Studio上運行手機,但它不再安裝。Android應用程序無法安裝intent.action.VIEW

我的清單在下面,我已經添加了intent過濾器以使其再次安裝,所以現在我得到一個警告,指出它不能被Google搜索索引。 我能做些什麼,因此安裝並可索引?

這是我的第一個應用程序,所以如果這是顯而易見的道歉,但我感謝任何幫助。謝謝。

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.somename.myappname"> 

    <uses-permission android:name="android.permission.INTERNET" /> 

    <application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 
     android:supportsRtl="true" 
     android:theme="@style/AppTheme"> 

     <activity android:name=".MainActivity" 
      android:windowSoftInputMode="stateHidden"> 
      <intent-filter> 
       <!--action android:name="android.intent.action.VIEW" /--> 
       <action android:name="android.intent.action.MAIN" /> 

       <!--category android:name="android.intent.category.DEFAULT" /--> 
       <!--category android:name="android.intent.category.BROWSABLE" /--> 
       <category android:name="android.intent.category.LAUNCHER" /> 
       <!--data android:scheme="somename" 
        android:host="myappname" /--> 
      </intent-filter> 
     </activity> 

     <activity android:name=".ChildActivity"> 
     </activity> 

    </application> 

</manifest> 

回答

0

我似乎找到了解決方案。應該有2個獨立的意圖過濾器...

 <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.VIEW" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
      <category android:name="android.intent.category.BROWSABLE" /> 
      <data android:scheme="http" 
       android:host="www.mywebsite.com" 
       android:pathPrefix="/myappname" /> 
     </intent-filter> 
相關問題