Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • App invitation to facebook friend in android

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 979
    Comment on it

    How to invite facebook friends to install aperticular application

    There are two functions given that will help to implement app invitation functionality.

     CallbackManager callbackManager;
          ShareDialog shareDialog;
    

    First Function:-

     
     private void initializationToAppInvite()
        { 
          FacebookSdk.sdkInitialize(this);
           callbackManager = CallbackManager.Factory.create();
           shareDialog = new ShareDialog(this);
           Uri targetUrl =AppLinks.getTargetUrlFromInboundIntent(this, getIntent());
             if (targetUrl != null) 
                {
                   System.out.println("URL: " + targetUrl.toString());
                } 
              else 
                  {
                    AppLinkData.fetchDeferredAppLinkData(MenuView.this, new AppLinkData.CompletionHandler()
                       {
                        @Override
                        public void onDeferredAppLinkDataFetched(AppLinkData appLinkData) 
                               {
                                  if (appLinkData!=null)
                                     {
                                        System.out.println("Applink data" + appLinkData.toString());
                                      }
                                    else
                                        {
                                          System.out.println("appLinkData is null");
                                         }
                                   }
                            });
                         }
                    }
    

    Second Function:-

     /*********************************************** method to invite friends **********************************************/
               private void inviteFriends()
                {
                String appLinkUrl, previewImageUrl;
                appLinkUrl = "https:...."; // this applink url you will get from facebook developer when you register your application there
                previewImageUrl = "https:....abc.jpeg";  // this is the image link which you needed to post on app invite 
                if (AppInviteDialog.canShow()) 
                         {
                    AppInviteContent content = new AppInviteContent.Builder()
                    .setApplinkUrl(appLinkUrl)
                    .setPreviewImageUrl(previewImageUrl)
                    .build();
                    AppInviteDialog.show(this, content);
                }
                else
                {
                  Toast.makeText(MenuView.this.getApplicationContext(),"Native facebook app is missing", Toast.LENGTH_SHORT).show();
                }
                 }
    
    /***********************************************************************************************************/
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: