30
loading...
This website collects cookies to deliver better user experience
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/*");
...
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths" />
</provider>
...
<?xml version="1.0" encoding="utf-8"?>
<paths>
<cache-path path="telegram_stickers_import/" name="telegram_stickers_import" />
</paths>
/data/user/0/com.otopba.telegram_stickers_import_example/cache/telegram_stickers_import/sticker1.webp
content://com.otopba.telegram_stickers_import_example.provider/telegram_stickers_import/sticker1.webp
Info.plist
to make it work:<key>LSApplicationQueriesSchemes</key>
<array>
<string>tg</string>
</array>
class TelegramStickersImport {
/// Folder inside cache directory for store your stickers
static const androidImportFolderName = "telegram_stickers_import";
static const MethodChannel _channel = MethodChannel(
'telegram_stickers_import',
);
/// Method for import sticker set
static Future<String?> import(StickerSet stickerSet) async {
return _channel.invokeMethod('import', stickerSet.toMap());
}
}
cache/telegram_stickers_import
folder (or one that you set up by yourself);Uint8List
.
StickerData({this.path, this.bytes});
/// Android factory
factory StickerData.android(String path) {
return StickerData(path: path);
}
/// iOS factory
factory StickerData.iOS(Uint8List bytes) {
return StickerData(bytes: bytes);
}
30