Catch browser starting in a Service Android - android

Is it possible to catch when the link was clicked in Android Service.
I do know that it is impossible to catch onTouch Event in the service. But maybe WebBrowser starting is possible?. Please help! Very Important.
I need to start my Web Based app when the specific link was clicked.

An activity can be registered to be started using a url, which you define in your manifest
<activity android:name=".YourActivity">
<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="yourscheme" />
</intent-filter>
</activity>
Your activity will then be launched if a link looking like yourscheme://something is clicked

Related

Don't destroy activity

my app/activity (starts a tracking) can be started from another app. In my case the app is called from browser. I added an intent filter for incoming links.
<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:host="destination"
android:scheme="mwde" />
</intent-filter>
This works fine. My problem is, that when user start the activity again, the onDestroyed function is called, but I don't want that in this case. Is there any way to prevent this?
Try to use this flag in the app manifest
https://developer.android.com/guide/topics/manifest/activity-element#lmode

Which manifest tag makes my app available as default browser app?

I made an browser app for android and i want to make it available as browser app so i can choose it as default phone browser.
I have tried some intent filters but that did not work for me. I only can send texts or links to my application an it will open it but i want to make it choosable as default browser
What do i have to do? Please suggest me!!
Have you add the "action" attribute in manifest, with value "ACTION_VIEW" ?
add intent filter in your main activity
<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" />
</intent-filter>
and then, when click link in other app,your app will be in the popup chooser,
choose it as default。

How to launch the app from SMS content (link)

i need to launch my app when click on link that is received by sms or email.I mean, the person who receives the SMS simply taps on the link provided, and that launches the application.
Which ever Activity you want to open, when Link is clicked
Need to be use IntentFilter in Menifest like this
<activity
android:name=".interacting.InteractWithApps"
android:parentActivityName=".index.IndexActivity">
<intent-filter>
<data
android:host="www.domain.com"
android:scheme="http" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
You also need to define link schema and host
You should follow as per this link

android browser does not launch app

I am unable to get the app I have written to launch when a certain url is passed back to the browser.
When the user launches the default browser and goes to the where my server is running for example: www.test.com, a list of films and books are displayed on the remote server. When the user selects one of these items i.e. a film or book - the server sends back a url that starts with bb:// and contains the uri link.fil?data=1. So the url looks like this when sent back from the server:
bb://link.fil?data=1
Currently I have the manifest which declares the following filter intent:
<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="bb"
android:host="test.com"
android:path="/.*"
android:pathPattern="/.*\\.*"/>
/>
<data
android:scheme="bb"
android:host="www.test.com"
android:path="/.*"
android:pathPattern="/.*\\.*"
/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
What I am trying to make happen is when the user selects a book of film the returning url launches my app.
After following many of the examples on line I still don't seem to be able to get this to work, and would appreciate any help you can provide.
<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:host="link.fil"
android:scheme="bb" />
</intent-filter>
The issue lay with chrome and mozilla they were rejecting the invocation - when using the default browser on android the app was called from the browser as was required. So I am marking the previous answer as correct but the problem lies with iframe which chrome and mozzila are now using- Maybe some one has the answer for fixing these exceptions?

Implement deep linking in android from single activity

Although I have gone through related document on google for app indexing
https://developers.google.com/app-indexing/webmasters/details
But still have confusion that If I want to receive incoming data on launcher activity and from there If can take control and start relevant activity/fragment depending on some internal parsing over incoming url.
You have to declare the action, category and data in a separate <intent-filter> tag, not in the same one with launcher specs.
<activity>
<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:host="your.domain.com"
android:scheme="http" />
</intent-filter>
</activity>
Not quite sure if I understood what your asking, so please correct me if I'm not answering your question.
Only the activity (or activities) that you put the intent filter in will catch an intent and start. Therefore, if you only put the intent filter in one activity, only that activity will start, and not any of the others. You can put multiple intent filters in the same activity to catch multiple intents. You can also use the path segment of the url to send more information to your activity, and parse it in your activity.
Put the following in your manifest under the activity you want to launch (the path is optional):
<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.yourwebsite.com" />
</intent-filter>
Use a url like http://www.yourwebsite.com/yourstring to open the app.
Then use getIntent().getData() to get the uri that started the activity. You can then parse the uri to get yourstring.
Add Following Intent filter to Activity you want to open via Deep linking in Manifest.
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Then As per Intent data you get in Activity you can perform your action, too.

Categories

Resources