美文网首页
Manifest提示GoogleAppIndexingWarni

Manifest提示GoogleAppIndexingWarni

作者: Bernardo_Silva | 来源:发表于2019-03-16 08:57 被阅读0次

    App is not indexable by Google Search; consider adding at least one Activity with an ACTION-VIEW intent-filler. See issue explanation for more details.

    Adds deep links to get your app into the Google index, to get installs and traffic to your app from Google Search.

    看详细信息,意思是Activity可以添加ACTION-VIEW来支持Google的deep links,点击链接可以打开我们的App并跳转到相应的界面,还可以传递数据显示具体的页面。

    具体使用参考官方文档:https://developer.android.com/training/app-links/deep-linking#java

    第一步:声明相关的intent-filter

    <activity
        android:name="com.example.android.GizmosActivity">
        <intent-filter android:label="@string/filter_view_http_gizmos">
            <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-->
        </intent-filter>
    </activity>
    

    第二步:在对应的Activity做接收数据的处理

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    
        Intent intent = getIntent();
        String action = intent.getAction();
        Uri data = intent.getData();
    }
    

    第三步:可以通过adb shell 测试

    adb shell am start
            -W -a android.intent.action.VIEW
            -d <URI> <PACKAGE>
    
    adb shell am start
            -W -a android.intent.action.VIEW
            -d "http://www.example.com/gizmos" com.example.android
    

    最后,如果不需要使用此功能,又有强迫症,不想报黄提示,在application标签简单的添加这个就行了

    tools:ignore="GoogleAppIndexingWarning"
    

    相关文章

      网友评论

          本文标题:Manifest提示GoogleAppIndexingWarni

          本文链接:https://www.haomeiwen.com/subject/ofrjmqtx.html