Bug 60907 - DeepLinking is not indexing after latest update 2.5.0.91635
Summary: DeepLinking is not indexing after latest update 2.5.0.91635
Status: ASSIGNED
Alias: None
Product: Forms
Classification: Xamarin
Component: Samples ()
Version: 2.5.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Rui Marinho
URL:
Depends on:
Blocks:
 
Reported: 2017-11-29 07:31 UTC by Vitaly Chernikov
Modified: 2018-06-20 13:33 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Modifyed DeepLinking xamarin example, lib version updated and some firebase code added (2.69 MB, application/zip)
2017-11-29 07:31 UTC, Vitaly Chernikov
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 60907 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
ASSIGNED

Description Vitaly Chernikov 2017-11-29 07:31:23 UTC
Created attachment 25858 [details]
Modifyed DeepLinking xamarin example, lib version updated and some firebase code added

I took example from https://github.com/xamarin/xamarin-forms-samples/tree/master/DeepLinking

This example uses version of libary Xamarin.Forms and Xamarin.Forms.AppLink 2.3.0.49 and GooglePlayServices 29.* and DOESN'T use Firebase.
Ok. Its working well.

After I have updated all librarys to 2.5.0.91635 and GooglePlayServices to 42.* project, indexing throw error Firebase is not initialized.

I added Firebase initialization code and error avoided.

But indexing is not working.

Xamarin example here https://github.com/xamarin/xamarin-forms-samples/tree/master/DeepLinking

MY Updated example with firebase code and new librarys version is here
https://github.com/vdchernikov/TestKrista/blob/master/DeepLinking/Droid/MainActivity.cs

Projects differ only by version
was

   <package id="Xamarin.Forms" version="2.4.0.282" targetFramework="monoandroid60" />
   <package id="Xamarin.Forms.AppLinks" version="2.4.0.282" targetFramework="monoandroid60" />
   <package id="Xamarin.GooglePlayServices.AppIndexing" version="29.0.0.1" targetFramework="MonoAndroid60" />
   <package id="Xamarin.GooglePlayServices.Base" version="29.0.0.1" targetFramework="MonoAndroid60" />
   <package id="Xamarin.GooglePlayServices.Basement" version="29.0.0.1" targetFramework="MonoAndroid60" />

stay

 <package id="Xamarin.Firebase.AppIndexing" version="42.1021.1" targetFramework="monoandroid71" />
 <package id="Xamarin.Firebase.Common" version="42.1021.1" targetFramework="monoandroid71" />
 <package id="Xamarin.Forms" version="2.5.0.91635" targetFramework="monoandroid71" />
 <package id="Xamarin.Forms.AppLinks" version="2.5.0.91635" targetFramework="monoandroid71" />
 <package id="Xamarin.GooglePlayServices.AppIndexing" version="42.1021.1" targetFramework="monoandroid71" />
 <package id="Xamarin.GooglePlayServices.Base" version="42.1021.1" targetFramework="monoandroid71" />
 <package id="Xamarin.GooglePlayServices.Basement" version="42.1021.1" targetFramework="monoandroid71" />
 <package id="Xamarin.GooglePlayServices.Tasks" version="42.1021.1" targetFramework="monoandroid71" />

and some code for Firebase

public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
 {
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);

            var options = new FirebaseOptions.Builder()
            .SetApplicationId("1:36385392236:android:c0d54c779ee347e4")
            .SetApiKey("AIzaSyAX-rofUTdK9Z3SGRlvheFBSjyA3AyQRSQ")
            .SetDatabaseUrl("https://imposing-vista-173407.firebaseio.com")
            .SetGcmSenderId("36385392236-fqa95oavd2aic3gfbdidahh93gnif1b8.apps.googleusercontent.com")
            .SetStorageBucket("imposing-vista-173407.appspot.com")
            .Build();

            var app = FirebaseApp.InitializeApp(this, options);

            AndroidAppLinks.Init(this);

            LoadApplication(new App());
        }
 }

    async void OnSaveActivated(object sender, EventArgs e)
    {
        var todoItem = (TodoItem)BindingContext;

        if (isNewItem)
        {
            App.Database.Insert(todoItem);
        }
        else
        {
            App.Database.Update(todoItem);
        }

        appLink = GetTestAppLink("Kupertino datatron");

        try
        {
            Application.Current.AppLinks.RegisterLink(appLink);
        }
        catch (Exception exc)
        {
            var t = exc.Message;
        }

        await Navigation.PopAsync();
    }

    public static AppLinkEntry GetTestAppLink(string titleText)
    {
        var itemType = "question";
        var uri = new Uri(string.Format("http://testscheme.krista?id={0}", 23), UriKind.RelativeOrAbsolute);

        var pageLink = new AppLinkEntry
        {
            Title = titleText,
            Description = "Небольшое пояснение",
            AppLinkUri = uri,
            IsLinkActive = true,
            Thumbnail = ImageSource.FromFile("monkey.png")
        };

        pageLink.KeyValues.Add("contentType", "contentType");
        pageLink.KeyValues.Add("appName", App.AppName);
        pageLink.KeyValues.Add("companyName", "Krista");

        return pageLink;
    }
Comment 1 Vitaly Chernikov 2017-11-29 08:07:01 UTC
When you have run this example try add any note in app, and
then call Google Ok and write "Kupertino" - this won't searchable.

ATTENTION There I hardcoded test method 
appLink = GetTestAppLink("Kupertino datatron");
Comment 3 Rui Marinho 2018-03-24 01:49:50 UTC
actually I just hinted this in one of my apps :/ going to take a look on Monday.
Comment 4 faceoffers28 2018-04-07 15:00:43 UTC
I've encountered the same problem as shown here. https://forums.xamarin.com/discussion/125062/xamarin-forms-applinks-no-longer-working-correctly-after-upgrade It seems like Xamarin.Firebase.AppIndexing 42.1021.1 isn't interacting correctly with Xamarin.Forms.AppLinks 2.5.0.280555.
Comment 5 faceoffers28 2018-04-07 15:17:06 UTC
This might help too. I've fully documented my experience here to overcome the "Firebase initialization" bug with AppLinks. As you will see, I experienced the bug twice and only after setting my Target to 8.1, did it truly go away.  https://forums.xamarin.com/discussion/125059/applinks-crashes-with-make-sure-to-call-firebaseapp-initializeapp-context-first Hope this helps.
Comment 6 faceoffers28 2018-04-14 20:34:58 UTC
The bug came back and App Center caught it. 

FirebaseAppIndex.get_Instance ()
Java.Lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.domainname.appname. Make sure to call FirebaseApp.initializeApp(Context) first.
1
ExceptionDispatchInfo.Throw ()
2
JniEnvironment+StaticMethods.CallStaticObjectMethod (Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method)
3
JNIEnv.CallStaticObjectMethod (System.IntPtr jclass, System.IntPtr jmethod)
4
FirebaseAppIndex.get_Instance ()
5
AndroidAppLinks.IndexItemAsync (Xamarin.Forms.IAppLinkEntry appLink)

7
Offer+<OnAppearing>d__5.MoveNext ()
8
ExceptionDispatchInfo.Throw ()

I noticed in this sample that the developer is using a different version of Xamarin.Firebase.AppIndexing.

https://github.com/xamarin/xamarin-forms-samples/blob/master/DeepLinking/Droid/packages.config

I updated Xamarin.Firebase.AppIndexing to 60.1142.1 (+ all other packages that go with it) and the error has gone away again, but my items still do not display in Google Search.
Comment 7 faceoffers28 2018-04-23 16:25:18 UTC
@Rui Marinho Can we get an update on this? This is one of two issues that is holding up the launch of my latest Xamarin app. Thanks!
Comment 8 faceoffers28 2018-05-03 21:51:50 UTC
Can someone from Xamarin/Microsoft please acknowledge this bug and provide an update? I just reinstalled Xamarin.Forms and Xamarin.Forms.AppLinks to target monoandroid81 and it still doesn't work. Here is my new config.

<package id="Xamarin.Forms" version="2.5.1.444934" targetFramework="monoandroid81" />
  <package id="Xamarin.Forms.AppLinks" version="2.5.0.280555" targetFramework="monoandroid81" />
  <package id="Xamarin.GooglePlayServices.AppIndexing" version="60.1142.1" targetFramework="monoandroid81" />