簡體   English   中英

Android應用程序內容Firebase索引

[英]android app content firebase indexing

每當用戶在google app中搜索時,我都希望在Google搜索的移動應用中顯示我的應用內容,以便我的應用可以與我的應用內容一起顯示在列表中。換句話說,我正在尋找啟用個人內容火力索引的功能

我經歷了很多指南和文檔,我能夠為Web網址做應用程序索引。

但我也想在Google搜索中顯示我的應用程序內容,我試圖通過使用以下代碼來做到這一點。

我創建了意圖服務

public class AppIndexingService extends IntentService {
    DatabaseAccess databaseAccess;


    public AppIndexingService() {
        super("AppIndexingService");

    }

    @Override
    protected void onHandleIntent(Intent intent) {
        databaseAccess = DatabaseAccess.getInstance(getApplicationContext(), getResources().getString(R.string.shamukey));
        databaseAccess.open();
        ArrayList<Indexable> indexableNotes = new ArrayList<>();
ArrayList<RaviMessages>indexableMessagesArrayList=databaseAccess.readArticles("bagale");
        for (RaviMessages recipe :indexableMessagesArrayList ) {

            Indexable noteToIndex = Indexables.noteDigitalDocumentBuilder()
                .setName(recipe.getName())
                .setDescription(recipe.getStatus())
                  .setUrl("android-app://com.itsvibrant.FeelMyLoveMarathi/")
                .put("image","http://www.logospike.com/wp-content/uploads/2015/10/Android_Logo_04.png")
                .build();

                indexableNotes.add(object);
            }


        if (indexableNotes.size() > 0) {
            Indexable[] notesArr = new Indexable[indexableNotes.size()];
            notesArr = indexableNotes.toArray(notesArr);

            // batch insert indexable notes into index
            FirebaseAppIndex.getInstance().update(notesArr);
        }

    }
}

Android清單文件。

<application
        android:name=".ApplicationContext"
        android:allowBackup="true"
        android:icon="@mipmap/fml_mar"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <meta-data
            android:name="android.app.default_searchable"
            android:value="com.itsvibrant.FeelMyLoveMarathi.MainActivity" />

        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
            <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.SEARCH" />
            </intent-filter>

            <meta-data
                android:name="android.app.searchable"
                android:resource="@xml/searchable" />


            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="android-app"
                    android:host="com.itsvibrant.FeelMyLoveMarathi" />
                <data
                    android:host="ravindrabagale.com"
                    android:pathPrefix="/"
                    android:scheme="http" />
                <data
                    android:host="shayari"
                    android:scheme="ravindrabagale" />
            </intent-filter>
        </activity>

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

        <service android:name="AppIndexingService"
            android:exported="true"
            android:permission="com.google.android.gms.permission.APPINDEXING">
            <intent-filter>
                <action android:name="com.google.firebase.appindexing.UPDATE_INDEX" />
            </intent-filter>
        </service>


    </application>

但是,我仍然無法在Google搜索中顯示我的應用程序內容。 還是忘記了什么?

您是否已在https://www.google.com/webmasters/tools上為您的android應用和網站添加了正確的屬性?

另外,您是否通過Play商店的開發者門戶網站驗證了您的網站? 如果沒有,這是這些說明的鏈接。 由於某些原因,這些步驟並未在Firebase App Indexing示例中真正地直接闡明。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM