public override void Test()
        {
            SA_ScreenUtil.TakeScreenshot(256, (screenshot) => {
                var composer = new AN_ShareComposer();
                composer.SetTitle("Android Native Share Example");
                composer.SetText("Hello world");
                composer.AddImage(screenshot);
                composer.AddImage(screenshot);

                composer.Share(() => {
                    Debug.Log("Sharing flow is finished, User has retured to the app");
                    SetResult(SA_TestResult.OK);
                });
            });
        }
Example #2
0
#pragma warning restore 649

    private void Awake()
    {
        m_shareText.onClick.AddListener(() => {
            var composer = new AN_ShareComposer();
            composer.SetTitle("Android Native Share Example");
            composer.SetText("Hello world");

            composer.Share();
        });

        m_shareImage.onClick.AddListener(() => {
            SA_ScreenUtil.TakeScreenshot((screenshot) => {
                /*
                 * var composer = new AN_ShareComposer();
                 * composer.SetTitle("Android Native Share Example");
                 * composer.SetText("Hello world");
                 * composer.AddImage(screenshot);
                 *
                 * composer.Share();*/

                ShowSharingMenuAndroid(screenshot);
            });
        });


        m_shareImages.onClick.AddListener(() => {
            SA_ScreenUtil.TakeScreenshot((screenshot) => {
                var composer = new AN_ShareComposer();
                composer.SetTitle("Android Native Share Example");
                composer.SetText("Hello world");
                composer.AddImage(screenshot);
                composer.AddImage(screenshot);

                composer.Share(() => {
                    Debug.Log("Sharing flow is finished, User has retured to the app");
                });
            });
        });

        m_fbImage.onClick.AddListener(() => {
            SA_ScreenUtil.TakeScreenshot((screenshot) => {
                var composer = new AN_FacebookSharing();
                composer.AddImage(screenshot);

                composer.Share();
            });
        });


        m_fbImages.onClick.AddListener(() => {
            SA_ScreenUtil.TakeScreenshot((screenshot) => {
                var composer = new AN_FacebookSharing();
                composer.AddImage(screenshot);
                composer.AddImage(screenshot);

                composer.Share(() => {
                    Debug.Log("Sharing flow is finished, User has retured to the app");
                });
            });
        });


        m_instaImage.onClick.AddListener(() => {
            SA_ScreenUtil.TakeScreenshot((screenshot) => {
                var composer = new AN_InstagramSharing();
                composer.AddImage(screenshot);

                composer.Share();
            });
        });


        m_instaImages.onClick.AddListener(() => {
            SA_ScreenUtil.TakeScreenshot((screenshot) => {
                var composer = new AN_InstagramSharing();
                composer.AddImage(screenshot);
                composer.AddImage(screenshot);

                composer.Share();
            });
        });

        m_emil.onClick.AddListener(() => {
            SA_ScreenUtil.TakeScreenshot((screenshot) => {
                var composer = new AN_EmailComposer();

                composer.SetText("Testing the emailssharing\n example");
                composer.SetSubject("Hello worls");

                composer.AddRecipient("*****@*****.**");
                composer.AddRecipient("*****@*****.**");

                composer.AddImage(screenshot);
                // composer.AddImage(screenshot);

                composer.Share(() => {
                    Debug.Log("Sharing flow is finished, User has retured to the app");
                });
            });
        });



        m_twitter.onClick.AddListener(() => {
            SA_ScreenUtil.TakeScreenshot((screenshot) => {
                var composer = new AN_TwitterSharing();
                composer.AddImage(screenshot);
                composer.SetText("My twitt");

                composer.Share();
            });
        });


        m_whatsup.onClick.AddListener(() => {
            SA_ScreenUtil.TakeScreenshot((screenshot) => {
                var composer = new AN_WhatsappSharing();
                composer.AddImage(screenshot);
                composer.AddImage(screenshot);
                composer.SetText("My message");

                composer.Share();
            });
        });


        m_instllCheck.onClick.AddListener(() => {
            AN_Logger.Log(AN_FacebookSharing.IsAppInstalled);


            var pm   = AN_MainActivity.Instance.GetPackageManager();
            var info = pm.GetPackageInfo("random.app.name", AN_PackageManager.GET_ACTIVITIES);

            if (info == null)
            {
                AN_Logger.Log("not installed");
            }
            else
            {
                AN_Logger.Log("app installed");
            }
        });


        m_startFacebook.onClick.AddListener(() => {
            var pm = AN_MainActivity.Instance.GetPackageManager();
            AN_Intent startAppIntent = pm.GetLaunchIntentForPackage("com.facebook.katana");
            if (startAppIntent == null)
            {
                AN_Logger.Log("App with Id: com.facebook.katana not found on device");
                return;
            }
            startAppIntent.AddCategory(AN_Intent.CATEGORY_LAUNCHER);

            AN_MainActivity.Instance.StartActivity(startAppIntent);
        });


        m_composeSMS.onClick.AddListener(() => {
            string phoneNumber  = "+380956808684";
            AN_Intent smsIntent = new AN_Intent(AN_Intent.ACTION_VIEW, new Uri("sms:" + phoneNumber));
            smsIntent.PutExtra("sms_body", "Hello, how are you?");
            smsIntent.PutExtra(AN_Intent.EXTRA_TEXT, "Hello, how are you ?");
            AN_MainActivity.Instance.StartActivity(smsIntent);
        });
    }