Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

537
Visualizações
(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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda