Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

531
Views
(Share Intent) External Share Not Working in Android 12

After Android 12 update share intent not working in Samsung S10 device.This code is properly working in below Android version 12 devices but could not find the reason why in android 12 is filtering out.

        Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
        sharingIntent.setType("text/plain");
        // (Optional) If you want a preview title, set it with Intent.EXTRA_TITLE
        sharingIntent.putExtra(Intent.EXTRA_TITLE, str_title);
        sharingIntent.putExtra(Intent.EXTRA_TEXT, "https://www.cyranolab.media/msg/?q=507dddd6-8e43-11ec-9d11-061d7e6be791");
        sharingIntent.putExtra(Intent.EXTRA_SUBJECT, str_title);

        Intent receiver = new Intent(getActivityContext, UserSelectedShareBroadcast.class);
  PendingIntent pendingIntent;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
            pendingIntent = PendingIntent.getActivity(getActivityContext,
                    0, receiver, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
        }else {
            pendingIntent = PendingIntent.getActivity(getActivityContext,
                    0, receiver, PendingIntent.FLAG_UPDATE_CURRENT);
        }

        Intent openInChooser = Intent.createChooser(sharingIntent, "Choose", pendingIntent.getIntentSender());
        List<LabeledIntent> intentList = new ArrayList<>();

        Intent externalEmailIntent = new Intent(getActivityContext, ExternalEmailShareActivity.class);
        externalEmailIntent.putExtra("programId", programId);
        externalEmailIntent.putExtra("sharedResourceId", sharedResourceId);
        externalEmailIntent.putExtra("INBOX", "Inbox");
        intentList.add(new LabeledIntent(externalEmailIntent, "Package Name", "Email to", R.drawable.ic_mail_outline));
        // convert intentList to array
        LabeledIntent[] extraIntents = intentList.toArray(new LabeledIntent[0]);

        openInChooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, extraIntents);
        int REQUEST_SHARED_URL = 2;
        getActivityContext.startActivityForResult(openInChooser, REQUEST_SHARED_URL);
    }

I want to share my Programs to other Apps. I unable to share my program to other apps. Share intent not opened, After android 12 update.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Missing FLAG_IMMUTABLE To declare that a given PendingIntent object is mutable or immutable, use the PendingIntent.FLAG_MUTABLE or PendingIntent.FLAG_IMMUTABLE flag, respectively. Above code Just i added this lines: Working fine now

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
            pendingIntent = PendingIntent.getActivity(getActivityContext,
                    0, receiver, PendingIntent.FLAG_IMMUTABLE);
        }else {
            pendingIntent = PendingIntent.getActivity(getActivityContext,
                    0, receiver, PendingIntent.FLAG_UPDATE_CURRENT);
        }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!