title: Invite users with AppInviteDialog
body: <p>I am glad that Facebook finally let users invite their friends with the SDK version 4 but I don't know how to do it. The <a href="https://developers.facebook.com/docs/app-invites/android" rel="noreferrer">documentation</a> is clear at least for a while:</p>
  
  <pre><code>if (appInviteDialog.canShow()) {
        AppInviteContent content = new AppInviteContent.Builder()
            .setApplinkUrl("https://play.google.com/store/apps/details?id=com.myapp.android")
            .setPreviewImageUrl("http://www.myapp.com/Images/stub.jpg")
            .build();
        appInviteDialog.show(MainActivity.this, content);
  }
  </code></pre>
  
  <p>So far this couldn't be simpler. But once I select a user to invite I get Missing App Link URL error:</p>
  
  <p><img src="https://i.stack.imgur.com/AVUPN.png" alt="enter image description here"></p>
  
  <p>I understand I need to create an App Link URL, but I don't really know how. According to the <a href="https://developers.facebook.com/docs/app-invites/android#app_links" rel="noreferrer">documentation</a> I should put meta tags between the <code>&lt;head&gt;&lt;/head&gt;</code> sections on the website associated with my Facebook app in the developer console's Settings/Site URL section.</p>
  
  <p>So I put these on my website:</p>
  
  <pre><code>&lt;meta property="al:android:url" content="https://fb.me/1047359658624810" /&gt;
  &lt;meta property="al:android:app_name" content="MyApp" /&gt;
  &lt;meta property="al:android:package" content="com.myapp.android" /&gt;
  &lt;meta property="al:web:url" content="http://myapp.com" /&gt;
  </code></pre>
  
  <p>The <code>https://fb.me/1047359658624810</code> is created with the <a href="https://developers.facebook.com/quickstarts/?platform=app-links-host" rel="noreferrer">App link generator</a>.</p>
  
  <p><a href="https://developers.facebook.com/docs/applinks/add-to-content" rel="noreferrer">This part</a> is totally obscure. In the example the url is <code>sharesample://story/1234</code> and <code>sharesample</code> is defined as a scheme in an intent filter, but then what is <code>story/1234</code>?</p>
  
  <p>In the App Link Generator</p>
  
  <ol>
  <li><p>I added the intent filter to <code>AndroidManifest</code> with the scheme <code>&lt;data android:scheme="com.myapp.android" /&gt;</code></p></li>
  <li><p>I set deep linking in the launcher class as</p>
  
  <p><code>Uri targetUrl = AppLinks.getTargetUrlFromInboundIntent(this, getIntent());
  if (targetUrl != null) {
       Log.i("ACTIVITY", "App Link Target URL: " + targetUrl.toString());
  }</code></p></li>
  <li><p>I set the App Link Name as App Link URL for MyApp</p></li>
  <li>I set the URL as the Google Play URL</li>
  <li>I set the App Name as MyApp</li>
  <li>I set the package name as com.myapp.android</li>
  <li>Then I set the generated App Link URL on the website as</li>
  </ol>
  
  <p><code>&lt;meta property="al:android:url" content="https://fb.me/1047359658624810" /&gt;</code></p>
  
  <p>For now all I need is to be able to send app invites and when users click on them they should be taken to the Google Play URL of the app. It's like I'm one step from finishing this thing but I can't figure out what I am missing.</p>