Android Studio : App is not indexable by Google Search

App is not indexable by Google Search; consider adding at least one Activity with an ACTION-VIEW intent-filler.

ข้อความเตือนข้างต้นเพียงแค่บอกว่าให้เราเพิ่ม Action-view เพื่อให้ google search สามารถเข้ามาเก็บข้อมูลเพิ่มได้ เพื่อให้เกิด index บน google search ได้ ไม่ต้องแก้ไขก็ได้ แต่ถ้าต้องการแก้ warning ตัวนี้ เพียงแค่เพิ่มบรรทัดนี้เข้าไปใน AndroidManifest.xml

<activity
    android:name="com.example.android.GizmosActivity"
    android:label="@string/title_gizmos" >
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <!-- Accepts URIs that begin with "http://www.example.com/gizmos” -->
        <data android:scheme="http"
              android:host="www.example.com"
              android:pathPrefix="/gizmos" />
        <!-- note that the leading "/" is required for pathPrefix-->
        <!-- Accepts URIs that begin with "example://gizmos”
        <data android:scheme="example"
              android:host="gizmos" />
        -->
    </intent-filter>
</activity>

ในตัวอย่างคือการเพิ่ม action.VIEW ใน activity ใดๆ โดย uris ที่ให้ google search เข้าไปเก็บ index คือ http://www.example.com/gizmos ในกรณีถ้าเราไม่มี subfolder “/gizmos” เราก็คอมเมนท์บรรทัด pathPrefix ไปก็ได้ และก็เช่นกันถ้าเราให้ google search เข้าถึงด้วย http:// เท่านั้น ตรง data android:scheme=”example” ก็ตัดออกไปได้เลย เพราะว่าเราไม่ได้ให้เข้าถึงแบบ example://

เท่านี้ก็คอมไพล์ไม่ติด warning แล้วครับ

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *