android firebase dynamic link PendingDynamicLinkData is null direct through app












2















Problem: Why is "Short dynamic links" created programatically wont open/launch the app directly?



I want to launch app directly when user clicks the dynamic url created dynamically by android app.



When clicking dynamic short link created dynamically by android app the following things happen,



1.Option show two options one is through chrome other is through app



2.if i choose chrome option, browser opens, shows a loading dialog box and launch app with PendingDynamicLinkData data



3.but if i choose app option, app lauches app but PendingDynamicLinkData is lost or null.



Any Help would be great. my manifest setting is below



  <intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:host="myapp.page.link" android:scheme="http"/>
<data android:host="myapp.page.link" android:scheme="https"/>
</intent-filter>









share|improve this question





























    2















    Problem: Why is "Short dynamic links" created programatically wont open/launch the app directly?



    I want to launch app directly when user clicks the dynamic url created dynamically by android app.



    When clicking dynamic short link created dynamically by android app the following things happen,



    1.Option show two options one is through chrome other is through app



    2.if i choose chrome option, browser opens, shows a loading dialog box and launch app with PendingDynamicLinkData data



    3.but if i choose app option, app lauches app but PendingDynamicLinkData is lost or null.



    Any Help would be great. my manifest setting is below



      <intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW" />

    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />

    <data android:host="myapp.page.link" android:scheme="http"/>
    <data android:host="myapp.page.link" android:scheme="https"/>
    </intent-filter>









    share|improve this question



























      2












      2








      2








      Problem: Why is "Short dynamic links" created programatically wont open/launch the app directly?



      I want to launch app directly when user clicks the dynamic url created dynamically by android app.



      When clicking dynamic short link created dynamically by android app the following things happen,



      1.Option show two options one is through chrome other is through app



      2.if i choose chrome option, browser opens, shows a loading dialog box and launch app with PendingDynamicLinkData data



      3.but if i choose app option, app lauches app but PendingDynamicLinkData is lost or null.



      Any Help would be great. my manifest setting is below



        <intent-filter android:autoVerify="true">
      <action android:name="android.intent.action.VIEW" />

      <category android:name="android.intent.category.DEFAULT" />
      <category android:name="android.intent.category.BROWSABLE" />

      <data android:host="myapp.page.link" android:scheme="http"/>
      <data android:host="myapp.page.link" android:scheme="https"/>
      </intent-filter>









      share|improve this question
















      Problem: Why is "Short dynamic links" created programatically wont open/launch the app directly?



      I want to launch app directly when user clicks the dynamic url created dynamically by android app.



      When clicking dynamic short link created dynamically by android app the following things happen,



      1.Option show two options one is through chrome other is through app



      2.if i choose chrome option, browser opens, shows a loading dialog box and launch app with PendingDynamicLinkData data



      3.but if i choose app option, app lauches app but PendingDynamicLinkData is lost or null.



      Any Help would be great. my manifest setting is below



        <intent-filter android:autoVerify="true">
      <action android:name="android.intent.action.VIEW" />

      <category android:name="android.intent.category.DEFAULT" />
      <category android:name="android.intent.category.BROWSABLE" />

      <data android:host="myapp.page.link" android:scheme="http"/>
      <data android:host="myapp.page.link" android:scheme="https"/>
      </intent-filter>






      android firebase firebase-dynamic-links deeplink dynamic-links






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 15 '18 at 9:06







      Kim Young Hak

















      asked Nov 15 '18 at 7:49









      Kim Young HakKim Young Hak

      184




      184
























          1 Answer
          1






          active

          oldest

          votes


















          0














          You should handle your PendingDynamicLinkData in activity to override onCreate and onNewIntent. Like this:



          @Override
          protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          Intent intent = getIntent();
          if (intent != null) {
          handleDeepLink(intent);
          }
          }

          @Override
          protected void onNewIntent(Intent intent) {
          super.onNewIntent(intent);
          if (intent != null) {
          handleDeepLink(intent);
          }
          }

          private void handleDeepLink(Intent intent) {
          FirebaseDynamicLinks.getInstance().getDynamicLink(intent).addOnSuccessListener(pendingDynamicLinkData -> {
          if (pendingDynamicLinkData != null) {
          Uri deepLink = pendingDynamicLinkData.getLink();
          if (deepLink != null) {
          // todo .....
          }
          }
          });
          }





          share|improve this answer
























          • onNewIntent is never called

            – Kim Young Hak
            Nov 15 '18 at 9:03











          • try add to AndroidManifest.xml to your <activity> tag android:launchMode="singleInstance"

            – Onix
            Nov 15 '18 at 9:10











          • still not working....

            – Kim Young Hak
            Nov 15 '18 at 9:18











          • Do you use for handle PendingDynamicLinkData MainActivity that has intent-filter category android:name="android.intent.category.LAUNCHER?

            – Onix
            Nov 15 '18 at 9:29











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314626%2fandroid-firebase-dynamic-link-pendingdynamiclinkdata-is-null-direct-through-app%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          You should handle your PendingDynamicLinkData in activity to override onCreate and onNewIntent. Like this:



          @Override
          protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          Intent intent = getIntent();
          if (intent != null) {
          handleDeepLink(intent);
          }
          }

          @Override
          protected void onNewIntent(Intent intent) {
          super.onNewIntent(intent);
          if (intent != null) {
          handleDeepLink(intent);
          }
          }

          private void handleDeepLink(Intent intent) {
          FirebaseDynamicLinks.getInstance().getDynamicLink(intent).addOnSuccessListener(pendingDynamicLinkData -> {
          if (pendingDynamicLinkData != null) {
          Uri deepLink = pendingDynamicLinkData.getLink();
          if (deepLink != null) {
          // todo .....
          }
          }
          });
          }





          share|improve this answer
























          • onNewIntent is never called

            – Kim Young Hak
            Nov 15 '18 at 9:03











          • try add to AndroidManifest.xml to your <activity> tag android:launchMode="singleInstance"

            – Onix
            Nov 15 '18 at 9:10











          • still not working....

            – Kim Young Hak
            Nov 15 '18 at 9:18











          • Do you use for handle PendingDynamicLinkData MainActivity that has intent-filter category android:name="android.intent.category.LAUNCHER?

            – Onix
            Nov 15 '18 at 9:29
















          0














          You should handle your PendingDynamicLinkData in activity to override onCreate and onNewIntent. Like this:



          @Override
          protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          Intent intent = getIntent();
          if (intent != null) {
          handleDeepLink(intent);
          }
          }

          @Override
          protected void onNewIntent(Intent intent) {
          super.onNewIntent(intent);
          if (intent != null) {
          handleDeepLink(intent);
          }
          }

          private void handleDeepLink(Intent intent) {
          FirebaseDynamicLinks.getInstance().getDynamicLink(intent).addOnSuccessListener(pendingDynamicLinkData -> {
          if (pendingDynamicLinkData != null) {
          Uri deepLink = pendingDynamicLinkData.getLink();
          if (deepLink != null) {
          // todo .....
          }
          }
          });
          }





          share|improve this answer
























          • onNewIntent is never called

            – Kim Young Hak
            Nov 15 '18 at 9:03











          • try add to AndroidManifest.xml to your <activity> tag android:launchMode="singleInstance"

            – Onix
            Nov 15 '18 at 9:10











          • still not working....

            – Kim Young Hak
            Nov 15 '18 at 9:18











          • Do you use for handle PendingDynamicLinkData MainActivity that has intent-filter category android:name="android.intent.category.LAUNCHER?

            – Onix
            Nov 15 '18 at 9:29














          0












          0








          0







          You should handle your PendingDynamicLinkData in activity to override onCreate and onNewIntent. Like this:



          @Override
          protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          Intent intent = getIntent();
          if (intent != null) {
          handleDeepLink(intent);
          }
          }

          @Override
          protected void onNewIntent(Intent intent) {
          super.onNewIntent(intent);
          if (intent != null) {
          handleDeepLink(intent);
          }
          }

          private void handleDeepLink(Intent intent) {
          FirebaseDynamicLinks.getInstance().getDynamicLink(intent).addOnSuccessListener(pendingDynamicLinkData -> {
          if (pendingDynamicLinkData != null) {
          Uri deepLink = pendingDynamicLinkData.getLink();
          if (deepLink != null) {
          // todo .....
          }
          }
          });
          }





          share|improve this answer













          You should handle your PendingDynamicLinkData in activity to override onCreate and onNewIntent. Like this:



          @Override
          protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          Intent intent = getIntent();
          if (intent != null) {
          handleDeepLink(intent);
          }
          }

          @Override
          protected void onNewIntent(Intent intent) {
          super.onNewIntent(intent);
          if (intent != null) {
          handleDeepLink(intent);
          }
          }

          private void handleDeepLink(Intent intent) {
          FirebaseDynamicLinks.getInstance().getDynamicLink(intent).addOnSuccessListener(pendingDynamicLinkData -> {
          if (pendingDynamicLinkData != null) {
          Uri deepLink = pendingDynamicLinkData.getLink();
          if (deepLink != null) {
          // todo .....
          }
          }
          });
          }






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 15 '18 at 8:48









          OnixOnix

          4478




          4478













          • onNewIntent is never called

            – Kim Young Hak
            Nov 15 '18 at 9:03











          • try add to AndroidManifest.xml to your <activity> tag android:launchMode="singleInstance"

            – Onix
            Nov 15 '18 at 9:10











          • still not working....

            – Kim Young Hak
            Nov 15 '18 at 9:18











          • Do you use for handle PendingDynamicLinkData MainActivity that has intent-filter category android:name="android.intent.category.LAUNCHER?

            – Onix
            Nov 15 '18 at 9:29



















          • onNewIntent is never called

            – Kim Young Hak
            Nov 15 '18 at 9:03











          • try add to AndroidManifest.xml to your <activity> tag android:launchMode="singleInstance"

            – Onix
            Nov 15 '18 at 9:10











          • still not working....

            – Kim Young Hak
            Nov 15 '18 at 9:18











          • Do you use for handle PendingDynamicLinkData MainActivity that has intent-filter category android:name="android.intent.category.LAUNCHER?

            – Onix
            Nov 15 '18 at 9:29

















          onNewIntent is never called

          – Kim Young Hak
          Nov 15 '18 at 9:03





          onNewIntent is never called

          – Kim Young Hak
          Nov 15 '18 at 9:03













          try add to AndroidManifest.xml to your <activity> tag android:launchMode="singleInstance"

          – Onix
          Nov 15 '18 at 9:10





          try add to AndroidManifest.xml to your <activity> tag android:launchMode="singleInstance"

          – Onix
          Nov 15 '18 at 9:10













          still not working....

          – Kim Young Hak
          Nov 15 '18 at 9:18





          still not working....

          – Kim Young Hak
          Nov 15 '18 at 9:18













          Do you use for handle PendingDynamicLinkData MainActivity that has intent-filter category android:name="android.intent.category.LAUNCHER?

          – Onix
          Nov 15 '18 at 9:29





          Do you use for handle PendingDynamicLinkData MainActivity that has intent-filter category android:name="android.intent.category.LAUNCHER?

          – Onix
          Nov 15 '18 at 9:29


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314626%2fandroid-firebase-dynamic-link-pendingdynamiclinkdata-is-null-direct-through-app%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Xamarin.form Move up view when keyboard appear

          Post-Redirect-Get with Spring WebFlux and Thymeleaf

          Anylogic : not able to use stopDelay()