Supporting Http URLs

suggest change

Step 1 :- Allow Google to Crawl to your content.Edit server’s robot.txt file.You can control google crawling for your content by editing this file,you can refer to this link for more details.

Step 2 :- Associate your App with your website.Include assetlinks.json You upload it to your web server’s .well-known directory.Content of your assetlinks.json are as-

[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target" : 
{ "namespace": "android_app",
"package_name": "<your_package_name>",
"sha256_cert_fingerprints": ["<hash_of_app_certificate>"] }

}]

Step 3 :- Include App links in your manifest file to redirect Urls into your Application like below,

<activity
       android:name=".activity.SampleActivity"
       android:label="@string/app_name"
       android:windowSoftInputMode="adjustResize|stateAlwaysHidden">
       <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.live"
             android:pathPrefix="/vod"
             android:scheme="https"/>
       <data
             android:host="example.live"
             android:pathPrefix="/vod"
             android:scheme="http"/>
     </intent-filter>
   </activity>

Refer to this if you want learn about each and every tag here.

< action> Specify the ACTION_VIEW intent action so that the intent filter can be reached from Google Search.

< data> Add one or more tags, where each tag represents a URI format that resolves to the activity. At minimum, the tag must include the android:scheme attribute. You can add additional attributes to further refine the type of URI that the activity accepts. For example, you might have multiple activities that accept similar URIs, but which differ simply based on the path name. In this case, use the android:path attribute or its variants (pathPattern or pathPrefix) to differentiate which activity the system should open for different URI paths.

< category> Include the BROWSABLE category. The BROWSABLE category is required in order for the intent filter to be accessible from a web browser. Without it, clicking a link in a browser cannot resolve to your app. The DEFAULT category is optional, but recommended. Without this category, the activity can be started only with an explicit intent, using your app component name.

Step 4:- Handle incoming URLS

@Override
protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_schedule);
   onNewIntent(getIntent());
}

protected void onNewIntent(Intent intent) {
String action = intent.getAction();
Uri data = intent.getData();
if (Intent.ACTION_VIEW.equals(action) && data != null) {
   articleId = data.getLastPathSegment();
   TextView linkText = (TextView)findViewById(R.id.link);
   linkText.setText(data.toString());
}

}

Step 5 :- You can test this by using Android Debug Bridge command or studio configurations. Adb command:- Launch your application and then run this command:-

adb shell am start -a android.intent.action.VIEW -d "{URL}" < package name >

Android Studio Configurations:- Android studio > Build > Edit Configuration >Launch options>select URL>then type in your Url here >Apply and test.Run your application if “Run” window shows error then you need to check your URL format with your applinks mentioned in manifest otherwise it will successfully run,and redirect to page mentioned your URL if specified.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Firebase App Indexing:
* Supporting Http URLs

Table Of Contents
2 Gradle
5 Intent
17 Service
19 WebView
31 SQLite
35 Glide
37 Dialog
38 ACRA
44 Handler
53 Toast
63 Menu
65 Picasso
70 Volley
71 Widgets
78 Realm
90 Spinner
95 OkHttp
108 TextView
109 ListView
111 Loader
118 Xposed
119 Security
121 ImageView
123 Doze Mode
130 Drawables
131 Colors
134 Fresco
139 AdMob
145 Keyboard
146 Button
150 EditText
152 Firebase App Indexing
155 Vk SDK
163 ExoPlayer
169 XMPP
175 OpenCV
177 Threads
184 ORMLite
186 TabLayout
190 LruCache
192 Zip files
194 Fastlane
199 FileIO
202 Moshi
210 VideoView
216 Paint
218 ProGuard
226 CleverTap
228 ADB shell
229 Ping ICMP
230 AIDL
234 Context
240 JCodec
242 Okio
249 FuseView
254 Looper
261 Fastjson
263 Jackson
267 Smartcard