Android - Adding at Least One Activity with an Action-View Intent-Filter After Updating Sdk Version 23

Android - Adding at least one Activity with an ACTION-VIEW intent-filter after Updating SDK version 23

From official documentation :

To enable Google to crawl your app content and allow users to enter your app from search results, you must add intent filters for the relevant activities in your app manifest. These intent filters allow deep linking to the content in any of your activities. For example, the user might click on a deep link to view a page within a shopping app that describes a product offering that the user is searching for.

Using this link Enabling Deep Links for App Content you'll see how to use it.

And using this Test Your App Indexing Implementation how to test it.

The following XML snippet shows how you might specify an intent filter
in your manifest for deep linking.

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

To test via Android Debug Bridge

$ adb shell am start
-W -a android.intent.action.VIEW
-d <URI> <PACKAGE>

$ adb shell am start
-W -a android.intent.action.VIEW
-d "example://gizmos" com.example.android

Including two intent-filters, sharing same activity, action, category and mimeType

The two intent filters differ only by the label, which does not affect the function of the filter in any way.
I think you should have two activities (one for each operation), and both should have the same base class. Put the operation-specific code in the operation-specific activities.
Alternatively, you may ask the user what to do with the image.

What is the end result if I add ACTION-VIEW in my app?

Google app indexing is a warning in Android Studio that you can safely ignore. On enabling app indexing, Google will index your app so that it appears in relevant categories. But! It is designed to work with sites, meaning if a user searches for something and your website appears in the search and if you have app indexing on, then the app will also appear with your website link.

Demo:

Indexing Sample

Source: searchengineland.com

To enable deep linking on your app, you need to also go to:

1 - Sign into Play console

2 - Click on the app you want to enable deep linking

3 - Go to development tools section on the left.

4 - Go to Services&Apis

5 - Scroll to App Indexing from Google Search and verify the website.

Get action name of intent filter located in service tags in Android

Good news!

The solution is here,

final Intent providerIntent = new Intent(MediaBrowserService.SERVICE_INTERFACE);
List<ResolveInfo> mediaApps = pm.queryIntentServices(providerIntent, 0);
for (ResolveInfo info : mediaApps) {
Log.e("MEDIA APPS: ", String.valueOf((info.serviceInfo.packageName)));
}

Best regards...

Activity with two intent filters restarts, but the main intent-filter is not called when restarting, other intentet filter is called

Login Activity had two intent filters as follows.

<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.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
<data
android:scheme="content"
android:mimeType="application/octet-stream"
android:pathPattern=".*\\.asdf"
tools:ignore="AppLinkUrlError" />
</intent-filter>

but, when the Login Activity is launched by the second intent-filter and when I restart the app, it launches through the second intent-filter. that was the problem I had and what I wanted to do is open the activity using the first intent-filter when it gets restart.

I could solve this problem by adding the below line in Manifest file under login Activity`as follows.
line-->

android:noHistory="true"


Related Topics



Leave a reply



Submit