0

I want to have a share intent where it sends the message "here" and when the user clicks on the message, it takes them to my app in the google play store. Currently I'm not getting any text at all in the message

              
                val shareMessage = SpannableString("Here")
                shareMessage.setSpan(URLSpan("https://play.google.com/store/apps/details?id=" + BuildConfig.APPLICATION_ID), 0, 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)

                val sendIntent: Intent = Intent().apply {
                    action = Intent.ACTION_SEND
                    putExtra(Intent.EXTRA_TEXT, shareMessage)
                    type = "text/plain"
                }

              
                val shareIntent = Intent.createChooser(sendIntent, null)

                if (shareIntent.resolveActivity(context.packageManager) != null) {
                    context.startActivity(shareIntent)
                }
Edward
  • 113
  • 1
  • 8
  • Here you are trying to send data to other application. Intent Chooser will help to select the application whichever install in your android based on the action. So your application just sender. Receiver side they will handle. here you are trying to share your app link. so it will ask you to share with some social media and some other applications. Your application doesn't receive 'here' value. – Yabaze Cool Jul 28 '20 at 04:26
  • To share data to other application, the following link will help you. `https://stackoverflow.com/questions/4969217/share-application-link-in-android` – Yabaze Cool Jul 28 '20 at 04:27
  • Developer documents related to this available in `https://developer.android.com/training/sharing/send`. and `https://developer.android.com/training/sharing/receive` – Yabaze Cool Jul 28 '20 at 04:28
  • Thanks for the response. Yes that's the basic idea but I instead of saying "Download my https://play.google.com/...." I want it to say "Download my app here" with the word here being hyperlinked to the app store – Edward Jul 28 '20 at 13:57

0 Answers0