I have this link which I want to link a specific activity on clicking this url.
I am able to link "http://example.com" to my application, but when I tried using this query parameter in the path prefix, it returned nothing.
I use this intent-filter to link my url :
<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:host="example.com"
android:scheme="http"
android:pathPrefix="/"/>
</intent-filter>
Here I don't know what is the path prefix for my Url.
It does not solve your problem, but to test your URL try this ADB command:
adb shell 'am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "http://example.com?path_resolution=xyz&city=abc"'
Related
I need to open a deep link in my Android app, like uniqueName://post/detail/1 in the router but it always removes the first part of the link: (post) and delegates only the rest: /detail/1 instead of /post/detail/1
AndroidManifest.xml:
<intent-filter android:priority="1">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="uniqueName"/>
</intent-filter>
onGenerateRoute:
Route? onGenerateRoute(RouteSettings settings) {
print('Change main route to: ${settings.name}');// prints /detail/1
}
Test:
adb shell am start -a android.intent.action.VIEW
-c android.intent.category.BROWSABLE
-d "uniqueName://post/detail/1"
I'm trying to set up android app link for my add but they are not working.
I modified my manifest.xaml (android/app/src/main), by adding :
<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="http" android:host="example.com" />
<data android:scheme="https" />
</intent-filter>
and added a assetlinks.json to my website (./well-known/assetlinks.json).
And when i validate it by browsing on https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=https://example.com&relation=delegate_permission/common.handle_all_urls, it says there is no errors but my app link is not working when i open it with adb shell am start -a android.intent.action.VIEW -d "https://example.com"
When i try to find the app link with adb shell dumpsys package domain-preferred-apps, it says it does not exists.
I aldready verified my sha256 key and my app package on the assetlinks.json...
Can someone please help me :)
In my application i am using deep links to navigate to Particular activity. I want to navigate to different activities with same basePrefix with different context path at end.
<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="https"
android:host="www.mycompany.com"
android:pathPrefix="/profile/friendslist"/>
</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="https"
android:host="www.mycompany.com"
android:pathPrefix="/profile/friendslist/details"/>
</intent-filter>
./adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "https://www.mycompany.com//profile/friendslist" com.mycompany.sample : It launches FriendsListFragment
./adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "https://www.mycompany.com//profile/friendslist/details" com.mycompany.sample : It also launches FriendsListFragment instead of FriendsListDetailsFragment
What i want to do is
/profile/friendslist/: should open FriendsList
/profile/friendslist/details?id=1234 should navigate to FriendDetails
Anyone suggest how we make use of android:pathPrefix to navigate to different screens based on context path?
You may opt for a pathPattern in the first 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="https"
android:host="www.mycompany.com"
android:pathPattern="/profile/friendslist$"/>
</intent-filter>
The $ indicates end of string, which would drop the "/profile/friendslist/details" case
OR Rather, go for android:path="/profile/friendslist" which looks for an exact match.
Please see the two links below. When pasted in Whatsapp, first one opens with Facebook app, but the second one opens with browser.
Opens in Facebook app:
https://m.facebook.com/SriSwamiji/posts/1099353043449548:0
Opens in Browser:
https://www.facebook.com/SriSwamiji/photos/a.186720728046122.67368.108460819205447/1099353043449548/?type=3
What makes the second link open in browser ?
I want to open it via Facebook app.
I would say that is due to deep linking. In any of your apps you could add filters that trigger your app whenever the Android system tries to resolve an URL.
Probably the Facebook app has configured the deep link of thehttp://m.* urls
edit: I've tested it via adb and it is due to deep linking. You can test it with
adb shell am start -W -a android.intent.action.VIEW -d <URL>
as explained in the deep link documentation
This is the output:
$ adb shell am start -W -a android.intent.action.VIEW -d "https://m.facebook.com/SriSwamiji/posts/1099353043449548:0"
Starting: Intent { act=android.intent.action.VIEW dat=https://m.facebook.com/... }
Status: ok
Activity: com.facebook.katana/com.facebook.deeplinking.activity.StoryDeepLinkLoadingActivity
ThisTime: 127
TotalTime: 208
WaitTime: 253
Complete
As you can see the Activity launched is com.facebook.katana (the Facebook app).
$ adb shell am start -W -a android.intent.action.VIEW -d "https://www.facebook.com/SriSwamiji/photos/a.186720728046122.67368.108460819205447/1099353043449548/?type=3"
Starting: Intent { act=android.intent.action.VIEW dat=https://www.facebook.com/... }
Status: ok
Activity: com.android.chrome/org.chromium.chrome.browser.document.DocumentActivity
ThisTime: 121
TotalTime: 179
WaitTime: 223
Complete
In this case com.android.chrome is launched
Also, if you take a look to the Facebook app manifest (with some app like ManifestViewer you can see that it has some intent-filter to handle it:
<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="m.facebook.com"
android:pathPrefix="/events"/>
<data
android:scheme="https"
android:host="m.facebook.com"
android:pathPrefix="/events"/>
<data
android:scheme="http"
android:host="m.facebook.com"
android:pathPrefix="/groups"/>
<data
android:scheme="https"
android:host="m.facebook.com"
android:pathPrefix="/groups"/>
<data
android:scheme="http"
android:host="www.facebook.com"
android:pathPrefix="/groups"/>
<data
android:scheme="https"
android:host="www.facebook.com"
android:pathPrefix="/groups"/>
<data
android:scheme="http"
android:host="www.facebook.com"
android:pathPrefix="/events"/>
<data
android:scheme="https"
android:host="www.facebook.com"
android:pathPrefix="/events"/>
</intent-filter>
In your concrete case I would say that that link is handled in
<activity
android:theme="#2131625627"
android:name="com.facebook.katana.ContactUriHandler"
android:taskAffinity="com.facebook.task.ContactUriHandler"
android:excludeFromRecents="true"
android:launchMode="singleInstance">
<intent-filter>
<action
android:name="android.intent.action.VIEW"/>
<category
android:name="android.intent.category.DEFAULT"/>
<data
android:mimeType="vnd.android.cursor.item/vnd.facebook.profile"
android:host="com.android.contacts"/>
<data
android:mimeType="vnd.android.cursor.item/vnd.facebook.presence"
android:host="com.android.contacts"/>
</intent-filter>
</activity>
and internally has support for posts but not for photos
I'm trying to enable deep linking so that certain links launch my app.
I read this turotial https://developer.android.com/training/app-indexing/deep-linking.html and following it pretty close but when I try to test it by using adb to send the VIEW intent to the app I just get the error
Error: Activity not started, unable to resolve Intent { act=android.intent.actio
n.VIEW dat=example://gizmos flg=0x10000000 pkg=com.myapp.DeepLinkActivity }
DeepLinkActivity.java
public class DeepLinkActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getIntent().getAction() == Intent.ACTION_VIEW) {
Uri uri = getIntent().getData();
}
}
}
Android Manifest declaring deeplink activity
<activity android:name="com.myapp.DeepLinkActivity" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="gizmos"
android:scheme="example" />
<!-- Accepts URIs that begin with "http://www.example.com/gizmos” -->
<data
android:host="www.example.com"
android:pathPrefix="gizmos"
android:scheme="http" />
</intent-filter>
</activity>
ADB command to send the view intent
adb shell am start -W -a android.intent.action.VIEW -d "example://gizmos" com.myapp.DeepLinkActivity
But I don't think I even need the full path to the activity
adb shell am start -W -a android.intent.action.VIEW -d "example://gizmos" com.myapp
Try skipping package param entirely. I had exactly same problem and it works.
adb shell am start -W -a android.intent.action.VIEW -d "example://gizmos"
Comment out the second data part from your Android Manifest. As per google documentation of deep link :
"Intent filters may only contain a single data element for a URI pattern. Create separate intent filters to capture additional URI patterns."
In your manifest you defined your scheme as "http" but in your intent constructor you are using "example."
The problem is you have one intent filter for 2 types of deep links:
<activity
android:name="app.myActivity"
android:label="#string/app_name"
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" />
<!-- Accepts URIs that begin with "example://gizmos”-->
<data
android:host="gizmos"
android:scheme="example" />
</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:host="www.example.com"
android:pathPrefix="/gizmos"
android:scheme="http" />
<!-- note that the leading "/" is required for pathPrefix-->
</intent-filter>
</activity>
And you will be able to use both on the ADB shell. Please see my full answer here
Simply try as follows
Command:
adb shell am start -d your-deep-link
Example:
adb shell am start -d rmagazine://opensetting/v1