Android Studio Deep Link using URI
Like the dozen other threads out there, I am trying to debug directly on a device using Android Studio via a uri. But I can't seem to find an exact example of someone doing so from Android Studio using the Edit Configuration. Sure something simple I am missing...
Here is what I am doing:
- Add the uri to the Edit Configuration:
Here is the intent in the AndroidManifest.xml:
<activity
android:name="com.mayapp.StartActivity"
android:configChanges="orientation|keyboardHidden|screenSize|keyboard|navigation"
android:label="StartActivity"
android:launchMode="singleTask"
android:windowSoftInputMode="stateHidden" >
<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=myapp" />
</intent-filter>
</activity>
The following error shows up when I try to debug:
As Text:
11/21 13:15:05: Launching MyApp
Launching deeplink: myapp%3A%2F%2Fdispatch.
$ adb shell setprop log.tag.AppIndexApi VERBOSE
$ adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d myapp%3A%2F%2Fdispatch -D
Error while executing: am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d myapp%3A%2F%2Fdispatch -D
Starting: Intent { act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=myapp://dispatch }
Error: Activity not started, unable to resolve Intent act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=myapp://dispatch flg=0x10000000
Error while Launching URL
android android-studio deep-linking
add a comment |
Like the dozen other threads out there, I am trying to debug directly on a device using Android Studio via a uri. But I can't seem to find an exact example of someone doing so from Android Studio using the Edit Configuration. Sure something simple I am missing...
Here is what I am doing:
- Add the uri to the Edit Configuration:
Here is the intent in the AndroidManifest.xml:
<activity
android:name="com.mayapp.StartActivity"
android:configChanges="orientation|keyboardHidden|screenSize|keyboard|navigation"
android:label="StartActivity"
android:launchMode="singleTask"
android:windowSoftInputMode="stateHidden" >
<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=myapp" />
</intent-filter>
</activity>
The following error shows up when I try to debug:
As Text:
11/21 13:15:05: Launching MyApp
Launching deeplink: myapp%3A%2F%2Fdispatch.
$ adb shell setprop log.tag.AppIndexApi VERBOSE
$ adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d myapp%3A%2F%2Fdispatch -D
Error while executing: am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d myapp%3A%2F%2Fdispatch -D
Starting: Intent { act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=myapp://dispatch }
Error: Activity not started, unable to resolve Intent act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=myapp://dispatch flg=0x10000000
Error while Launching URL
android android-studio deep-linking
add a comment |
Like the dozen other threads out there, I am trying to debug directly on a device using Android Studio via a uri. But I can't seem to find an exact example of someone doing so from Android Studio using the Edit Configuration. Sure something simple I am missing...
Here is what I am doing:
- Add the uri to the Edit Configuration:
Here is the intent in the AndroidManifest.xml:
<activity
android:name="com.mayapp.StartActivity"
android:configChanges="orientation|keyboardHidden|screenSize|keyboard|navigation"
android:label="StartActivity"
android:launchMode="singleTask"
android:windowSoftInputMode="stateHidden" >
<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=myapp" />
</intent-filter>
</activity>
The following error shows up when I try to debug:
As Text:
11/21 13:15:05: Launching MyApp
Launching deeplink: myapp%3A%2F%2Fdispatch.
$ adb shell setprop log.tag.AppIndexApi VERBOSE
$ adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d myapp%3A%2F%2Fdispatch -D
Error while executing: am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d myapp%3A%2F%2Fdispatch -D
Starting: Intent { act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=myapp://dispatch }
Error: Activity not started, unable to resolve Intent act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=myapp://dispatch flg=0x10000000
Error while Launching URL
android android-studio deep-linking
Like the dozen other threads out there, I am trying to debug directly on a device using Android Studio via a uri. But I can't seem to find an exact example of someone doing so from Android Studio using the Edit Configuration. Sure something simple I am missing...
Here is what I am doing:
- Add the uri to the Edit Configuration:
Here is the intent in the AndroidManifest.xml:
<activity
android:name="com.mayapp.StartActivity"
android:configChanges="orientation|keyboardHidden|screenSize|keyboard|navigation"
android:label="StartActivity"
android:launchMode="singleTask"
android:windowSoftInputMode="stateHidden" >
<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=myapp" />
</intent-filter>
</activity>
The following error shows up when I try to debug:
As Text:
11/21 13:15:05: Launching MyApp
Launching deeplink: myapp%3A%2F%2Fdispatch.
$ adb shell setprop log.tag.AppIndexApi VERBOSE
$ adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d myapp%3A%2F%2Fdispatch -D
Error while executing: am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d myapp%3A%2F%2Fdispatch -D
Starting: Intent { act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=myapp://dispatch }
Error: Activity not started, unable to resolve Intent act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=myapp://dispatch flg=0x10000000
Error while Launching URL
android android-studio deep-linking
android android-studio deep-linking
asked Nov 21 '18 at 21:50
Stephen McCormickStephen McCormick
771826
771826
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
So, it would seem that there are several problems to what I was doing. What is interesting is that the way the AndroidManifest.xml was configured some 4 years ago seemed to be working, but to run in Android Studio not only does the scheme
need to be specified but also the home
in the Intent. In my case I have several actions associated with the same scheme
, so the answer was to have multiple data sections within the same intent
. I could not find any Android documentation on that, but I could have just missed it. So for anyone who might encounter this in the future here is what I did:
In the AndroidManifest.XML define the
intent
just like I did, but make sure there is ahome
also. Obviously what you want the app to do when it does open can be different, seems to be a lot of info on that around so I am not including it here. For each action you want to trigger off of, add a newdata
section:
<activity
android:name="com.myapp.StartActivity"
android:configChanges="orientation|keyboardHidden|screenSize|keyboard|navigation"
android:label="StartActivity"
android:launchMode="singleTask"
android:windowSoftInputMode="stateHidden" >
<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="myapp" android:host="anondispatch"/>
<data android:scheme="myapp" android:host="dispatch"/>
<data android:scheme="myapp" android:host="openform"/>
<data android:scheme="myapp" android:host="opendispatch"/>
</intent-filter>
</activity>
In the code you can catch the opening in the
onIntent()
method in the specifiedactivity
(in my example it isStartActivity
). Here is a sample of the code parsing out the elements you are looking for:
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
Intent intent = getIntent();
if (intent.getAction() != null) {
if (Intent.ACTION_VIEW.equals(intent.getAction())) {
Uri uri = intent.getData();
String host = uri.getHost(); `
String uriStr = uri.toString();
if (host.equalsIgnoreCase("anondispatch")) {
// parse out that you want
}
else if (host.equalsIgnoreCase("opendispatch")) {
// parse out that you want
}
else if (host.equalsIgnoreCase("openform")) {
// parse out that you want
}
else if (host.equalsIgnoreCase("dispatch)) {
// parse out that you want
}
}
}
}
}
Update the configuration, from the Edit Configuration so the debugger can run on a remote device via USB by using the following:
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53420951%2fandroid-studio-deep-link-using-uri%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
So, it would seem that there are several problems to what I was doing. What is interesting is that the way the AndroidManifest.xml was configured some 4 years ago seemed to be working, but to run in Android Studio not only does the scheme
need to be specified but also the home
in the Intent. In my case I have several actions associated with the same scheme
, so the answer was to have multiple data sections within the same intent
. I could not find any Android documentation on that, but I could have just missed it. So for anyone who might encounter this in the future here is what I did:
In the AndroidManifest.XML define the
intent
just like I did, but make sure there is ahome
also. Obviously what you want the app to do when it does open can be different, seems to be a lot of info on that around so I am not including it here. For each action you want to trigger off of, add a newdata
section:
<activity
android:name="com.myapp.StartActivity"
android:configChanges="orientation|keyboardHidden|screenSize|keyboard|navigation"
android:label="StartActivity"
android:launchMode="singleTask"
android:windowSoftInputMode="stateHidden" >
<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="myapp" android:host="anondispatch"/>
<data android:scheme="myapp" android:host="dispatch"/>
<data android:scheme="myapp" android:host="openform"/>
<data android:scheme="myapp" android:host="opendispatch"/>
</intent-filter>
</activity>
In the code you can catch the opening in the
onIntent()
method in the specifiedactivity
(in my example it isStartActivity
). Here is a sample of the code parsing out the elements you are looking for:
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
Intent intent = getIntent();
if (intent.getAction() != null) {
if (Intent.ACTION_VIEW.equals(intent.getAction())) {
Uri uri = intent.getData();
String host = uri.getHost(); `
String uriStr = uri.toString();
if (host.equalsIgnoreCase("anondispatch")) {
// parse out that you want
}
else if (host.equalsIgnoreCase("opendispatch")) {
// parse out that you want
}
else if (host.equalsIgnoreCase("openform")) {
// parse out that you want
}
else if (host.equalsIgnoreCase("dispatch)) {
// parse out that you want
}
}
}
}
}
Update the configuration, from the Edit Configuration so the debugger can run on a remote device via USB by using the following:
add a comment |
So, it would seem that there are several problems to what I was doing. What is interesting is that the way the AndroidManifest.xml was configured some 4 years ago seemed to be working, but to run in Android Studio not only does the scheme
need to be specified but also the home
in the Intent. In my case I have several actions associated with the same scheme
, so the answer was to have multiple data sections within the same intent
. I could not find any Android documentation on that, but I could have just missed it. So for anyone who might encounter this in the future here is what I did:
In the AndroidManifest.XML define the
intent
just like I did, but make sure there is ahome
also. Obviously what you want the app to do when it does open can be different, seems to be a lot of info on that around so I am not including it here. For each action you want to trigger off of, add a newdata
section:
<activity
android:name="com.myapp.StartActivity"
android:configChanges="orientation|keyboardHidden|screenSize|keyboard|navigation"
android:label="StartActivity"
android:launchMode="singleTask"
android:windowSoftInputMode="stateHidden" >
<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="myapp" android:host="anondispatch"/>
<data android:scheme="myapp" android:host="dispatch"/>
<data android:scheme="myapp" android:host="openform"/>
<data android:scheme="myapp" android:host="opendispatch"/>
</intent-filter>
</activity>
In the code you can catch the opening in the
onIntent()
method in the specifiedactivity
(in my example it isStartActivity
). Here is a sample of the code parsing out the elements you are looking for:
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
Intent intent = getIntent();
if (intent.getAction() != null) {
if (Intent.ACTION_VIEW.equals(intent.getAction())) {
Uri uri = intent.getData();
String host = uri.getHost(); `
String uriStr = uri.toString();
if (host.equalsIgnoreCase("anondispatch")) {
// parse out that you want
}
else if (host.equalsIgnoreCase("opendispatch")) {
// parse out that you want
}
else if (host.equalsIgnoreCase("openform")) {
// parse out that you want
}
else if (host.equalsIgnoreCase("dispatch)) {
// parse out that you want
}
}
}
}
}
Update the configuration, from the Edit Configuration so the debugger can run on a remote device via USB by using the following:
add a comment |
So, it would seem that there are several problems to what I was doing. What is interesting is that the way the AndroidManifest.xml was configured some 4 years ago seemed to be working, but to run in Android Studio not only does the scheme
need to be specified but also the home
in the Intent. In my case I have several actions associated with the same scheme
, so the answer was to have multiple data sections within the same intent
. I could not find any Android documentation on that, but I could have just missed it. So for anyone who might encounter this in the future here is what I did:
In the AndroidManifest.XML define the
intent
just like I did, but make sure there is ahome
also. Obviously what you want the app to do when it does open can be different, seems to be a lot of info on that around so I am not including it here. For each action you want to trigger off of, add a newdata
section:
<activity
android:name="com.myapp.StartActivity"
android:configChanges="orientation|keyboardHidden|screenSize|keyboard|navigation"
android:label="StartActivity"
android:launchMode="singleTask"
android:windowSoftInputMode="stateHidden" >
<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="myapp" android:host="anondispatch"/>
<data android:scheme="myapp" android:host="dispatch"/>
<data android:scheme="myapp" android:host="openform"/>
<data android:scheme="myapp" android:host="opendispatch"/>
</intent-filter>
</activity>
In the code you can catch the opening in the
onIntent()
method in the specifiedactivity
(in my example it isStartActivity
). Here is a sample of the code parsing out the elements you are looking for:
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
Intent intent = getIntent();
if (intent.getAction() != null) {
if (Intent.ACTION_VIEW.equals(intent.getAction())) {
Uri uri = intent.getData();
String host = uri.getHost(); `
String uriStr = uri.toString();
if (host.equalsIgnoreCase("anondispatch")) {
// parse out that you want
}
else if (host.equalsIgnoreCase("opendispatch")) {
// parse out that you want
}
else if (host.equalsIgnoreCase("openform")) {
// parse out that you want
}
else if (host.equalsIgnoreCase("dispatch)) {
// parse out that you want
}
}
}
}
}
Update the configuration, from the Edit Configuration so the debugger can run on a remote device via USB by using the following:
So, it would seem that there are several problems to what I was doing. What is interesting is that the way the AndroidManifest.xml was configured some 4 years ago seemed to be working, but to run in Android Studio not only does the scheme
need to be specified but also the home
in the Intent. In my case I have several actions associated with the same scheme
, so the answer was to have multiple data sections within the same intent
. I could not find any Android documentation on that, but I could have just missed it. So for anyone who might encounter this in the future here is what I did:
In the AndroidManifest.XML define the
intent
just like I did, but make sure there is ahome
also. Obviously what you want the app to do when it does open can be different, seems to be a lot of info on that around so I am not including it here. For each action you want to trigger off of, add a newdata
section:
<activity
android:name="com.myapp.StartActivity"
android:configChanges="orientation|keyboardHidden|screenSize|keyboard|navigation"
android:label="StartActivity"
android:launchMode="singleTask"
android:windowSoftInputMode="stateHidden" >
<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="myapp" android:host="anondispatch"/>
<data android:scheme="myapp" android:host="dispatch"/>
<data android:scheme="myapp" android:host="openform"/>
<data android:scheme="myapp" android:host="opendispatch"/>
</intent-filter>
</activity>
In the code you can catch the opening in the
onIntent()
method in the specifiedactivity
(in my example it isStartActivity
). Here is a sample of the code parsing out the elements you are looking for:
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
Intent intent = getIntent();
if (intent.getAction() != null) {
if (Intent.ACTION_VIEW.equals(intent.getAction())) {
Uri uri = intent.getData();
String host = uri.getHost(); `
String uriStr = uri.toString();
if (host.equalsIgnoreCase("anondispatch")) {
// parse out that you want
}
else if (host.equalsIgnoreCase("opendispatch")) {
// parse out that you want
}
else if (host.equalsIgnoreCase("openform")) {
// parse out that you want
}
else if (host.equalsIgnoreCase("dispatch)) {
// parse out that you want
}
}
}
}
}
Update the configuration, from the Edit Configuration so the debugger can run on a remote device via USB by using the following:
answered Nov 23 '18 at 21:33
Stephen McCormickStephen McCormick
771826
771826
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53420951%2fandroid-studio-deep-link-using-uri%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown