无法从Google Play商店接收数据

时间:2019-04-13 12:14:14

标签: android android-intent google-play

所有人!

我无法使用文档(https://developer.android.com/training/sharing/receive)从Google Plat Store接收网址

首先,我在清单中添加了<intent-filter>

<intent-filter>
                <action android:name="android.intent.action.SEND"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <data android:mimeType="*/*"/>
</intent-filter>

P.S .:我也尝试将mimeType更改为text/plain。 在我的MainActivity中,我写了 this (针对OnCreateOnResume方法):

Intent intent = getIntent();
        String action = intent.getAction();
        String type = intent.getType();
        if(Intent.ACTION_SEND.equals(action) && type != null){
            if("*/*".equals(type)){
                addAppDialog.show(getSupportFragmentManager(), "AddBottomSheet");
                String getIntentAppName = intent.getStringExtra(Intent.EXTRA_TEXT);
                AddAppDialog.appUrl.setText(getIntentAppName);
            }
        }

但是,操作类型给了我null

如何解决这个问题?

0 个答案:

没有答案