Я хочу поделиться определенной деятельностью (Android)

Я разрабатываю приложение, в котором я хочу поделиться определенной деятельностью. Я сделал это ранее, чтобы поделиться приложением через Google Play; но в этом случае я хочу поделиться, и когда вы отправите ссылку напрямую, откройте экран, с которого вы поделились; и если у вас не установлено приложение, откройте страницу Google Play. Может кто-то помочь мне, пожалуйста? Мой код:

МАНИФЕСТ:

<activity
    android:name=".FichaLibro"
    android:label="@string/strTitleActivityFichaLibro"
    android:screenOrientation="portrait">

            <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.example.com"
                    android:pathPrefix="/gizmos" />

            </intent-filter>

</activity>

JAVA (FichaLibro.java):

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_ficha_libro);

        Intent intent = getIntent();
        idLibro = intent.getStringExtra("idLibro");
        usuario = (Usuario) intent.getSerializableExtra("usuario");

        altaElementos();


        Intent intentUri = getIntent();
        String action = intentUri.getAction();
        String type = intentUri.getType();
        Uri data = intentUri.getData();
        Uri data2 = (Uri)intentUri.getParcelableExtra(Intent.EXTRA_STREAM);


        Log.v("ACTION", action+"");
        Log.v("TYPE", type+"");
        Log.v("URI", data+"");
        Log.v("URI2", data2+"");

ALL LOG RETURN NULL. ЗАЧЕМ?????

если я создаю приложение с одним действием (MainActivity) и включается в манифест

<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.example.com"
          android: Pathprefix = "/ gizmos" />

</ intent-filter>

Предполагается получить значение действия и данные категории, верно?

Intent intentUri = getIntent();
String action = intentUri.getAction();
String type = intentUri.getType();
Uri data = intentUri.getData();
Uri data2 = (Uri)intentUri.getParcelableExtra(Intent.EXTRA_STREAM);

или я должен сделать что-то еще??

СПАСИБО!!

1 ответ

Это только мое предположение. Может быть, ссылка как https://play.google.com/store/apps/details?id=yourPageckageName/ activtyC

// <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="httpa" />
        </intent-filter>

    </activity>

в деятельности:

 onCreate(){
//read extra
//skip to activityC
}

Другие вопросы по тегам