Skip to content

Instantly share code, notes, and snippets.

@S64
Last active Aug 22, 2016
Embed
What would you like to do?
[Activity(Label = "AnotherImplicitActivity")]
[IntentFilter(
new[] { Intent.ActionView },
Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable },
DataScheme = "https",
DataHost = "example.wantedly.com",
DataPathPattern = PATH_PATTERN_1
)]
[IntentFilter(
new[] { Intent.ActionView },
Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable },
DataScheme = "wtd-example",
DataHost = "example_content",
DataPathPattern = PATH_PATTERN_2
)]
public class AnotherImplicitActivity : Activity
{
public const string PATH_PATTERN_1 = "/example_content/.*";
public const string PATH_PATTERN_2 = "/.*";
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
Android.Net.Uri uri;
if (this.Intent != null && (uri = this.Intent.Data) != null)
{
var m1 = Regex.Match(uri.Path, PATH_PATTERN_1);
var m2 = Regex.Match(uri.Path, PATH_PATTERN_2);
if (m1.Success)
{
UpdateContent(uri.PathSegments[1]); // TODO
} else if (m2.Success)
{
UpdateContent(uri.PathSegments[0]); // TODO
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment