mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-02-23 19:36:29 +01:00
Implemented deeplinking in android
This commit is contained in:
parent
950c50f218
commit
d734d4e5e5
13 changed files with 12150 additions and 9637 deletions
|
@ -191,6 +191,9 @@
|
||||||
<PackageReference Include="Xamarin.GooglePlayServices.Basement" Version="117.6.0.2" />
|
<PackageReference Include="Xamarin.GooglePlayServices.Basement" Version="117.6.0.2" />
|
||||||
<PackageReference Include="Xamarin.GooglePlayServices.Maps" Version="117.0.1.1" />
|
<PackageReference Include="Xamarin.GooglePlayServices.Maps" Version="117.0.1.1" />
|
||||||
<PackageReference Include="Xamarin.GooglePlayServices.Tasks" Version="117.2.1.1" />
|
<PackageReference Include="Xamarin.GooglePlayServices.Tasks" Version="117.2.1.1" />
|
||||||
|
<PackageReference Include="Xamarin.Forms.AppLinks">
|
||||||
|
<Version>5.0.0.2244</Version>
|
||||||
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Mono.Android" />
|
<Reference Include="Mono.Android" />
|
||||||
|
|
|
@ -4,11 +4,28 @@ using Android.Content.PM;
|
||||||
using Android.OS;
|
using Android.OS;
|
||||||
using Android.Content;
|
using Android.Content;
|
||||||
using Java.Interop;
|
using Java.Interop;
|
||||||
|
using Xamarin.Forms.Platform.Android.AppLinks;
|
||||||
|
using Firebase;
|
||||||
|
|
||||||
namespace TINK.Droid
|
namespace TINK.Droid
|
||||||
{
|
{
|
||||||
[Activity (Label = "LastenradBayern", Icon = "@drawable/sharee", Theme="@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
[Activity (Label = "LastenradBayern", Icon = "@drawable/sharee", Theme="@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
||||||
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
|
||||||
|
[IntentFilter(new[] { Intent.ActionView },
|
||||||
|
Categories = new[] { Intent.ActionView, Intent.CategoryBrowsable, Intent.CategoryDefault },
|
||||||
|
DataScheme = "https",
|
||||||
|
DataHost = "sharee.bike", // TODO: Adjust to correct domain
|
||||||
|
DataPathPrefix = "/",
|
||||||
|
AutoVerify = true)]
|
||||||
|
|
||||||
|
[IntentFilter(new[] { Intent.ActionView },
|
||||||
|
Categories = new[] { Intent.ActionView, Intent.CategoryBrowsable, Intent.CategoryDefault },
|
||||||
|
DataScheme = "http",
|
||||||
|
DataHost = "sharee.bike", // TODO: Adjust to correct domain
|
||||||
|
DataPathPrefix = "/",
|
||||||
|
AutoVerify = true)]
|
||||||
|
|
||||||
|
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
||||||
{
|
{
|
||||||
protected override void OnCreate (Bundle bundle)
|
protected override void OnCreate (Bundle bundle)
|
||||||
{
|
{
|
||||||
|
@ -19,6 +36,9 @@ namespace TINK.Droid
|
||||||
|
|
||||||
global::Xamarin.Forms.Forms.Init (this, bundle);
|
global::Xamarin.Forms.Forms.Init (this, bundle);
|
||||||
|
|
||||||
|
FirebaseApp.InitializeApp(this);
|
||||||
|
AndroidAppLinks.Init(this);
|
||||||
|
|
||||||
// Initialize xamarin.essentials, see https://docs.microsoft.com/en-us/xamarin/essentials/get-started?tabs=macos%2Candroid.
|
// Initialize xamarin.essentials, see https://docs.microsoft.com/en-us/xamarin/essentials/get-started?tabs=macos%2Candroid.
|
||||||
Xamarin.Essentials.Platform.Init(this, bundle);
|
Xamarin.Essentials.Platform.Init(this, bundle);
|
||||||
|
|
||||||
|
|
7194
LastenradBayern/TINK.Android/Resources/Resource.Designer.cs
generated
7194
LastenradBayern/TINK.Android/Resources/Resource.Designer.cs
generated
File diff suppressed because it is too large
Load diff
|
@ -254,6 +254,28 @@ namespace TINK
|
||||||
.CreateLogger();
|
.CreateLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <param name="uri">The URI for the request.</param>
|
||||||
|
/// <summary>Overriden to respond when the user initiates an app link request.</summary>
|
||||||
|
protected override void OnAppLinkRequestReceived(Uri uri)
|
||||||
|
{
|
||||||
|
base.OnAppLinkRequestReceived(uri);
|
||||||
|
// TODO: Adjust to correct host
|
||||||
|
if (uri.Host.ToLower() == "sharee.bike")
|
||||||
|
{
|
||||||
|
// Input e.g. sharee.bike/sharee/lastenrad/?lat=49.921&long=32.51
|
||||||
|
Array segments = Array.ConvertAll(uri.Segments, segment => segment.Replace("/", "")).Skip(1).ToArray();
|
||||||
|
Dictionary<string, string> queryDict = uri.Query
|
||||||
|
.Substring(1)
|
||||||
|
.Split("&")
|
||||||
|
.Select(query => query.Split('='))
|
||||||
|
.ToDictionary(query => query.FirstOrDefault(), query => query.Skip(1).FirstOrDefault());
|
||||||
|
// segments == ["sharee", "lastenrad"]
|
||||||
|
// queryDict == [{["lat", "49.921"]}], {["long", "32.51"]}]
|
||||||
|
// => Navigate and pass params depending on linkinput
|
||||||
|
// If no custom navigation is configured, the app just opens as if the user opened it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary> Gets the current logging level.</summary>
|
/// <summary> Gets the current logging level.</summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private static LogEventLevel GetCurrentLogEventLevel()
|
private static LogEventLevel GetCurrentLogEventLevel()
|
||||||
|
|
|
@ -4,11 +4,28 @@ using Android.Content.PM;
|
||||||
using Android.OS;
|
using Android.OS;
|
||||||
using Android.Content;
|
using Android.Content;
|
||||||
using Java.Interop;
|
using Java.Interop;
|
||||||
|
using Xamarin.Forms.Platform.Android.AppLinks;
|
||||||
|
using Firebase;
|
||||||
|
|
||||||
namespace TINK.Droid
|
namespace TINK.Droid
|
||||||
{
|
{
|
||||||
[Activity (Label = "Mein konrad", Icon = "@drawable/sharee", Theme="@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
[Activity (Label = "Mein konrad", Icon = "@drawable/sharee", Theme="@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
||||||
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
|
||||||
|
[IntentFilter(new[] { Intent.ActionView },
|
||||||
|
Categories = new[] { Intent.ActionView, Intent.CategoryBrowsable, Intent.CategoryDefault },
|
||||||
|
DataScheme = "https",
|
||||||
|
DataHost = "sharee.bike", // TODO: Adjust to correct domain
|
||||||
|
DataPathPrefix = "/",
|
||||||
|
AutoVerify = true)]
|
||||||
|
|
||||||
|
[IntentFilter(new[] { Intent.ActionView },
|
||||||
|
Categories = new[] { Intent.ActionView, Intent.CategoryBrowsable, Intent.CategoryDefault },
|
||||||
|
DataScheme = "http",
|
||||||
|
DataHost = "sharee.bike", // TODO: Adjust to correct domain
|
||||||
|
DataPathPrefix = "/",
|
||||||
|
AutoVerify = true)]
|
||||||
|
|
||||||
|
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
||||||
{
|
{
|
||||||
protected override void OnCreate (Bundle bundle)
|
protected override void OnCreate (Bundle bundle)
|
||||||
{
|
{
|
||||||
|
@ -19,6 +36,9 @@ namespace TINK.Droid
|
||||||
|
|
||||||
global::Xamarin.Forms.Forms.Init (this, bundle);
|
global::Xamarin.Forms.Forms.Init (this, bundle);
|
||||||
|
|
||||||
|
FirebaseApp.InitializeApp(this);
|
||||||
|
AndroidAppLinks.Init(this);
|
||||||
|
|
||||||
// Initialize xamarin.essentials, see https://docs.microsoft.com/en-us/xamarin/essentials/get-started?tabs=macos%2Candroid.
|
// Initialize xamarin.essentials, see https://docs.microsoft.com/en-us/xamarin/essentials/get-started?tabs=macos%2Candroid.
|
||||||
Xamarin.Essentials.Platform.Init(this, bundle);
|
Xamarin.Essentials.Platform.Init(this, bundle);
|
||||||
|
|
||||||
|
|
|
@ -190,6 +190,9 @@
|
||||||
<PackageReference Include="Xamarin.GooglePlayServices.Basement" Version="117.6.0.2" />
|
<PackageReference Include="Xamarin.GooglePlayServices.Basement" Version="117.6.0.2" />
|
||||||
<PackageReference Include="Xamarin.GooglePlayServices.Maps" Version="117.0.1.1" />
|
<PackageReference Include="Xamarin.GooglePlayServices.Maps" Version="117.0.1.1" />
|
||||||
<PackageReference Include="Xamarin.GooglePlayServices.Tasks" Version="117.2.1.1" />
|
<PackageReference Include="Xamarin.GooglePlayServices.Tasks" Version="117.2.1.1" />
|
||||||
|
<PackageReference Include="Xamarin.Forms.AppLinks">
|
||||||
|
<Version>5.0.0.2244</Version>
|
||||||
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Mono.Android" />
|
<Reference Include="Mono.Android" />
|
||||||
|
|
7194
Meinkonrad/TINK.Android/Resources/Resource.Designer.cs
generated
7194
Meinkonrad/TINK.Android/Resources/Resource.Designer.cs
generated
File diff suppressed because it is too large
Load diff
|
@ -254,6 +254,28 @@ namespace TINK
|
||||||
.CreateLogger();
|
.CreateLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <param name="uri">The URI for the request.</param>
|
||||||
|
/// <summary>Overriden to respond when the user initiates an app link request.</summary>
|
||||||
|
protected override void OnAppLinkRequestReceived(Uri uri)
|
||||||
|
{
|
||||||
|
base.OnAppLinkRequestReceived(uri);
|
||||||
|
// TODO: Adjust to correct host
|
||||||
|
if (uri.Host.ToLower() == "sharee.bike")
|
||||||
|
{
|
||||||
|
// Input e.g. sharee.bike/sharee/lastenrad/?lat=49.921&long=32.51
|
||||||
|
Array segments = Array.ConvertAll(uri.Segments, segment => segment.Replace("/", "")).Skip(1).ToArray();
|
||||||
|
Dictionary<string, string> queryDict = uri.Query
|
||||||
|
.Substring(1)
|
||||||
|
.Split("&")
|
||||||
|
.Select(query => query.Split('='))
|
||||||
|
.ToDictionary(query => query.FirstOrDefault(), query => query.Skip(1).FirstOrDefault());
|
||||||
|
// segments == ["sharee", "lastenrad"]
|
||||||
|
// queryDict == [{["lat", "49.921"]}], {["long", "32.51"]}]
|
||||||
|
// => Navigate and pass params depending on linkinput
|
||||||
|
// If no custom navigation is configured, the app just opens as if the user opened it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary> Gets the current logging level.</summary>
|
/// <summary> Gets the current logging level.</summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private static LogEventLevel GetCurrentLogEventLevel()
|
private static LogEventLevel GetCurrentLogEventLevel()
|
||||||
|
|
|
@ -4,11 +4,28 @@ using Android.Content.PM;
|
||||||
using Android.OS;
|
using Android.OS;
|
||||||
using Android.Content;
|
using Android.Content;
|
||||||
using Java.Interop;
|
using Java.Interop;
|
||||||
|
using Xamarin.Forms.Platform.Android.AppLinks;
|
||||||
|
using Firebase;
|
||||||
|
|
||||||
namespace TINK.Droid
|
namespace TINK.Droid
|
||||||
{
|
{
|
||||||
[Activity (Label = "Sharee", Icon = "@drawable/sharee", Theme="@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
[Activity (Label = "Sharee", Icon = "@drawable/sharee", Theme="@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
|
||||||
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
|
||||||
|
[IntentFilter(new[] { Intent.ActionView },
|
||||||
|
Categories = new[] { Intent.ActionView, Intent.CategoryBrowsable, Intent.CategoryDefault },
|
||||||
|
DataScheme = "https",
|
||||||
|
DataHost = "sharee.bike",
|
||||||
|
DataPathPrefix = "/",
|
||||||
|
AutoVerify = true)]
|
||||||
|
|
||||||
|
[IntentFilter(new[] { Intent.ActionView },
|
||||||
|
Categories = new[] { Intent.ActionView, Intent.CategoryBrowsable, Intent.CategoryDefault },
|
||||||
|
DataScheme = "http",
|
||||||
|
DataHost = "sharee.bike",
|
||||||
|
DataPathPrefix = "/",
|
||||||
|
AutoVerify = true)]
|
||||||
|
|
||||||
|
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
||||||
{
|
{
|
||||||
protected override void OnCreate (Bundle bundle)
|
protected override void OnCreate (Bundle bundle)
|
||||||
{
|
{
|
||||||
|
@ -19,6 +36,9 @@ namespace TINK.Droid
|
||||||
|
|
||||||
global::Xamarin.Forms.Forms.Init (this, bundle);
|
global::Xamarin.Forms.Forms.Init (this, bundle);
|
||||||
|
|
||||||
|
FirebaseApp.InitializeApp(this);
|
||||||
|
AndroidAppLinks.Init(this);
|
||||||
|
|
||||||
// Initialize xamarin.essentials, see https://docs.microsoft.com/en-us/xamarin/essentials/get-started?tabs=macos%2Candroid.
|
// Initialize xamarin.essentials, see https://docs.microsoft.com/en-us/xamarin/essentials/get-started?tabs=macos%2Candroid.
|
||||||
Xamarin.Essentials.Platform.Init(this, bundle);
|
Xamarin.Essentials.Platform.Init(this, bundle);
|
||||||
|
|
||||||
|
|
7217
TINK/TINK.Android/Resources/Resource.Designer.cs
generated
7217
TINK/TINK.Android/Resources/Resource.Designer.cs
generated
File diff suppressed because it is too large
Load diff
|
@ -190,6 +190,9 @@
|
||||||
<PackageReference Include="Xamarin.GooglePlayServices.Basement" Version="117.6.0.2" />
|
<PackageReference Include="Xamarin.GooglePlayServices.Basement" Version="117.6.0.2" />
|
||||||
<PackageReference Include="Xamarin.GooglePlayServices.Maps" Version="117.0.1.1" />
|
<PackageReference Include="Xamarin.GooglePlayServices.Maps" Version="117.0.1.1" />
|
||||||
<PackageReference Include="Xamarin.GooglePlayServices.Tasks" Version="117.2.1.1" />
|
<PackageReference Include="Xamarin.GooglePlayServices.Tasks" Version="117.2.1.1" />
|
||||||
|
<PackageReference Include="Xamarin.Forms.AppLinks">
|
||||||
|
<Version>5.0.0.2244</Version>
|
||||||
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Mono.Android" />
|
<Reference Include="Mono.Android" />
|
||||||
|
@ -663,6 +666,9 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AndroidResource Include="Resources\drawable-xxxhdpi\sharee_no_background.png" />
|
<AndroidResource Include="Resources\drawable-xxxhdpi\sharee_no_background.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<GoogleServicesJson Include="google-services.json" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="..\TINK\TINK.projitems" Label="Shared" Condition="Exists('..\TINK\TINK.projitems')" />
|
<Import Project="..\TINK\TINK.projitems" Label="Shared" Condition="Exists('..\TINK\TINK.projitems')" />
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||||
<ProjectExtensions>
|
<ProjectExtensions>
|
||||||
|
|
39
TINK/TINK.Android/google-services.json
Normal file
39
TINK/TINK.Android/google-services.json
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
{
|
||||||
|
"project_info": {
|
||||||
|
"project_number": "1088928386656",
|
||||||
|
"project_id": "shareetest-46bf8",
|
||||||
|
"storage_bucket": "shareetest-46bf8.appspot.com"
|
||||||
|
},
|
||||||
|
"client": [
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:1088928386656:android:84c634fd6c64679a22fd05",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "com.TeilRad.sharee.bike"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "1088928386656-vot2dsqetl5cegf15aheu5v8kl8iud0b.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyBDHV9nrt1Wy20f8GkFZroi3kH_YQ8rfgQ"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "1088928386656-vot2dsqetl5cegf15aheu5v8kl8iud0b.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
|
@ -254,6 +254,27 @@ namespace TINK
|
||||||
.CreateLogger();
|
.CreateLogger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <param name="uri">The URI for the request.</param>
|
||||||
|
/// <summary>Overriden to respond when the user initiates an app link request.</summary>
|
||||||
|
protected override void OnAppLinkRequestReceived(Uri uri)
|
||||||
|
{
|
||||||
|
base.OnAppLinkRequestReceived(uri);
|
||||||
|
if (uri.Host.ToLower() == "sharee.bike")
|
||||||
|
{
|
||||||
|
// Input e.g. sharee.bike/sharee/lastenrad/?lat=49.921&long=32.51
|
||||||
|
Array segments = Array.ConvertAll(uri.Segments, segment => segment.Replace("/", "")).Skip(1).ToArray();
|
||||||
|
Dictionary<string, string> queryDict = uri.Query
|
||||||
|
.Substring(1)
|
||||||
|
.Split("&")
|
||||||
|
.Select(query => query.Split('='))
|
||||||
|
.ToDictionary(query => query.FirstOrDefault(), query => query.Skip(1).FirstOrDefault());
|
||||||
|
// segments == ["sharee", "lastenrad"]
|
||||||
|
// queryDict == [{["lat", "49.921"]}], {["long", "32.51"]}]
|
||||||
|
// => Navigate and pass params depending on linkinput
|
||||||
|
// If no custom navigation is configured, the app just opens as if the user opened it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary> Gets the current logging level.</summary>
|
/// <summary> Gets the current logging level.</summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private static LogEventLevel GetCurrentLogEventLevel()
|
private static LogEventLevel GetCurrentLogEventLevel()
|
||||||
|
|
Loading…
Add table
Reference in a new issue