android - How to open URL in my webViewApp from outside -
i created android app, has webview load pages.
in app, home page edittext , button, if user enters url in textbox enters button, webview loads webpage. works fine.
if user clicks url in whatsapp, mobile has options open url in browsers.
i added following code in manifest file, list app along browsers open urls
<intent-filter> <action android:name="redacted.mainactivity" /> <category android:name="android.intent.category.default" /> <category android:name="android.intent.category.browsable" /> <data android:scheme="http" /> <data android:scheme="https" /> <action android:name="android.intent.action.view" /> </intent-filter>
now, app name available option open urls. when select app open url, doesn't paste url in edit text.
what need add more.
in main activity need describe how oncreate behave when application opened intent.
reference link:- link
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); // intent started activity intent intent = getintent(); uri data = intent.getdata(); // figure out based on intent type if (intent.gettype().indexof("image/") != -1) { // handle intents image data ... } else if (intent.gettype().equals("text/plain")) { // handle intents text ... } }
Comments
Post a Comment