Forum Xamarin.Forms

New version of AppLinks.RegisterLink() didn't work on Android

VitalyVitaly USMember ✭✭

Example version of DeepLink is working, ok. This version is 2.3.9.****
But when I added in my project last this version*** there rise new error
"Default FirebaseApp is not initialized in this process", so ok. I got google-services.json file, got key values for property builder and try again.
And it works without error but it does nothing indexing, I see nithing in google ok search popup.

Why new Application.Current.AppLinks.RegisterLink(appLink); needs Firebase library and why it doesn't work with this all?
Old versin 2.3.9.** are working at
but when you updating this to last it stay asking firebase, is this Firebase initialization correct? Why doesn't work?

My code

 protected override async void OnCreate(Bundle bundle)
        ToolbarResource = Resource.Layout.Toolbar;

        base.OnCreate(bundle );

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

        var options = new FirebaseOptions.Builder()

        FirebaseApp.InitializeApp(this, options);

        catch(Exception exc)
            var t = exc.Message;

        LoadApplication(new App(new SystemFolders(), new KeyboardManager(this), new SpeechRecognizerDroid(this), new YandexSpeechKit(ApiKey), new AudioPlayer(this)));

  private async void HandleDoneButtonClicked()
        var appLink = App.GetTestAppLink("купертино");

        catch (Exception exc)
            var t = exc.Message;

        await Navigation.PopModalAsync();


  • VitalyVitaly USMember ✭✭

    Why it does not indexing? Without Firebase initialization it throw error

    {Java.Lang.NullPointerException: null reference
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
    at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance,
    Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in :0
    at Android.Runtime.JNIEnv.CallObjectMethod (System.IntPtr jobject, System.IntPtr jmethod, Android.Runtime.JValue* parms) [0x0000e] in <2e14bb2dd93a405e81838369ed72695b>:0
    at Firebase.AppIndexing.Builders.IndexableBuilder.SetDescription (System.String description) [0x00051] in :0
    at Xamarin.Forms.Platform.Android.AppLinks.AndroidAppLinks.GetIndexable (Xamarin.Forms.IAppLinkEntry appLink, System.String url) [0x00021] in :0
    at Xamarin.Forms.Platform.Android.AppLinks.AndroidAppLinks.IndexItemAsync (Xamarin.Forms.IAppLinkEntry appLink) [0x00016] in :0
    at Xamarin.Forms.Platform.Android.AppLinks.AndroidAppLinks.RegisterLink (Xamarin.Forms.IAppLinkEntry appLink) [0x00000] in :0


    {Java.Lang.IllegalStateException: Default FirebaseApp is not initialized in this process krista.datatron.datatron. Make sure to call FirebaseApp.initializeApp(Context) first.

  • VitalyVitaly USMember ✭✭

    My packages versions are

     <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="" targetFramework="monoandroid71" />
     <package id="Xamarin.Forms.AppLinks" version="" 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" />
  • VitalyVitaly USMember ✭✭

    There modified source code from working

    and it is my that is not working

    They differ only by versions of libraries and Firebase initializations

  • VitalyVitaly USMember ✭✭

    Have anybody tried my sample?

  • marcnegrimarcnegri CHMember ✭✭

    Hi @Vitaly

    Do you find a workaround regarding your issue ?
    Have you try to try catch your FirebaseApp.InitializeApp(this, options); ?

  • batmacibatmaci DEMember ✭✭✭✭✭

    hi, i am looking for this issue as well. did you guys find any solution for it?

  • VitalyVitaly USMember ✭✭
    edited December 2017

    Hi @batmaci @marcnegri unfortunately I didn't. I raised bug issue on xamarin.bugzilla
    also created new theme but didn't receive answer.

    So I was needed to return to native indexing with bridges between core and android|ios indexing class. This indexing is working now. You may get this example from their Monkey sample app.

    My native indexing code is for Android

        public Android.Gms.AppIndexing.Action GetAppIndexActionForModel(SearchableItem searchItem)
            //// var url = $"{monkey.Name.Replace(" ", "%20")}";
            var url = searchItem.Url;
            var item = new Thing.Builder()
            var thing = new Android.Gms.AppIndexing.Action.Builder(Android.Gms.AppIndexing.Action.TypeView)
            return thing.JavaCast<Android.Gms.AppIndexing.Action>();

    Android Activity's OnCreate() is catching intent with url from and automaticly passing it to App.xaml.cs OnLinkReceive...()

    Sure adding headers

    [Activity(Icon = "@drawable/AppIcon", Theme = "@style/MyTheme.Base", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    [IntentFilter(new[] { Intent.ActionView },
    Categories = new[] {
    DataScheme = "http",
    DataHost = "",
    DataPathPrefix = "/question")]
    [IntentFilter(new[] { Intent.ActionView },
        Categories = new[]
        DataScheme = "http",
        DataHost = "")]
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
  • batmacibatmaci DEMember ✭✭✭✭✭

    can you please share your bugzilla link that i can also follow?

Sign In or Register to comment.