Giter Club home page Giter Club logo

telegramstickersimport's Introduction

Stickers Import Sample for Telegram

This is a sample project for importing stickers to Telegram via the Android app.

Please read the full documentation here: https://core.telegram.org/import-stickers

WARNING: Each time a user imports stickers, a new sticker pack is created on Telegram. Do not use the importing feature to share stickers you made with other users. If you want to share your stickers, simply upload them using @stickers, then share the link of your pack. For example, here's a link to install some Duck Stickers.

Supported file formats

  1. PNG or WEBP for static sticker packs with a transparent layer which must fit into a 512x512 square (one of the sides must be 512px and the other 512px or less).
  2. TGS for animated stickers packs.

How to use

Simply send an Android Intent with the action org.telegram.messenger.CREATE_STICKER_PACK and two extras:

  1. Intent.EXTRA_STREAM containing URIs to the stickers.
  2. STICKER_EMOJIS with relevant emojis for every sticker you importing.

Additionaly you can provide an IMPORTER extra for statistic purposes.

private static final String CREATE_STICKER_PACK_ACTION = "org.telegram.messenger.CREATE_STICKER_PACK";
private static final String CREATE_STICKER_PACK_EMOJIS_EXTRA = "STICKER_EMOJIS";
private static final String CREATE_STICKER_PACK_IMPORTER_EXTRA = "IMPORTER";

private void doImport(ArrayList<Uri> stickers, ArrayList<String> emojis) {
    Intent intent = new Intent(CREATE_STICKER_PACK_ACTION);
    intent.putExtra(Intent.EXTRA_STREAM, stickers);
    intent.putExtra(CREATE_STICKER_PACK_IMPORTER_EXTRA, getPackageName());
    intent.putExtra(CREATE_STICKER_PACK_EMOJIS_EXTRA, emojis);
    intent.setType("image/*");

    // Try to invoke the intent.
    try {
        startActivity(sendIntent);
    } catch (ActivityNotFoundException e) {
        // Define what your app should do if no activity can handle the intent.
    }
}

telegramstickersimport's People

Contributors

drklo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.