Last active
January 3, 2017 23:17
-
-
Save SelvinPL/19a9ab51d0567ecfd378622d68f1cd1f to your computer and use it in GitHub Desktop.
ProxyActivity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example" > | |
<application | |
<!-- other Activities goes here --> | |
<activity | |
android:name=".ProxyActivity" | |
android:label="Some nice label" | |
android:noHistory="true" | |
android:theme="@android:style/Theme.NoDisplay"> | |
<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="mywebsite.pl"/> | |
<data | |
android:scheme="http" | |
android:host="www.mywebsite.pl"/> | |
</intent-filter> | |
</activity> | |
</application> | |
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example; | |
import android.app.Activity; | |
import android.content.Intent; | |
import android.net.Uri; | |
import android.os.Bundle; | |
import android.text.TextUtils; | |
import android.widget.Toast; | |
public class ProxyActivity extends Activity { | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
final Intent intent = getIntent(); | |
if (intent != null) { | |
Uri uri = intent.getData(); | |
if (uri != null) { | |
if (TextUtils.isEmpty(uri.getPath()) || uri.getPath().equals("/")) { | |
Toast.makeText(this, "Starting HomeActivity", Toast.LENGTH_SHORT).show(); | |
} else { | |
Toast.makeText(this, "Starting SpecialActivity for path: " + uri.getPath(), Toast.LENGTH_SHORT).show(); | |
} | |
} | |
} | |
finish(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment