Closed sidoruvigo closed 4 years ago
Maybe the JAVA files you have on your root package are missing in the example?
@vincekruger have you find solution for this? getting same error
Third party pack cannot be found likely because the corresponding app is restricted, sdk: 28 ,power saving mode: false
@sidoruvigo can you please elaborate?
Awaiting feedback on Whatsapp Channel. This is Whatsapp related. :(
@Zeeshan0201 @vincekruger
I have tried to replicate this issue from a
Maybe the JAVA files you have on your root package are missing in the example?
I commented this based on flutter_whatsapp_stickers_internet, but they are added inside @vincekruger 's package.
However, with this package I never could add the stickers pack, but the flutter_whatsapp_stickers_internet implementation seems to work just sometimes. When I add a new stickers package with flutter_whatsapp_stickers_internet and then delete it the issue comes and this message can be found on log:
Third party pack cannot be found likely because the corresponding app is restricted, sdk: 23 ,power saving mode: false
For me, this only happens when I change the example stickers pack. If I leave the original example It seems to work until I change it. When the error arises, even if I change back to the original example, It doesn't work again.
I also tried to replicate this issue with this app (I suppose this is an app created with the whatsapp repository. I added and deleted some packages within seconds. After deleting the packages, they don't seem to add again, however, after tapping some times on the Add button, it works again.
As @vincekruger says, this may be a Whatsapp related issue. Hope they will give some feedback.
So I've done a lot of debugging on this and the issue seems to come into play when adding multiple packs consecutively. Once the error happens once, the app needs to be restarted. In my production apps, I don't see this error in any of my logs I only come across this when I'm developing. What I've done to mitigate this problem, for now, is to allow 3 - 5 mins before adding another pack to whats app.
I'm keen to wait for Whatsapp to comment on this problem too, my guess is that this is some sort of prevention mechanism they've implemented.
I'll keep this comment open and respond when I have more information.
@vincekruger please let us know when this issue will solve..waiting eagerly...
@Zeeshan0201 Whatsapp has marked this as a bug on their side. For now, we have to wait for WhatsApp. :(
I will keep this issue open until it's resolved.
Open Issue on WhatsApp repo: https://github.com/WhatsApp/stickers/issues/584
@vincekruger thanks for the update...
I'm in alert about that, marked your issue on whatsapp/stickers repo and here.. haha You think is an integration problem? I mean Flutter with Whatsapp/stickers android lib?
Hey guys. I think I found a solution to the issue.
What I did was
sticker_packs
folder contents with this -> https://github.com/WhatsApp/stickers/tree/master/Android/app/src/main/assetscontents.json
to sticker_packs.json
sticker_packs/sticker_packs.json
& sticker_packs/1/
to assets
in pubspec.yaml
(this is not mentioned in the documentation)flutter clean
flutter run
I found out "image_data_version": "1"
property was missing in the JSON file.
Let me know if this solved the issue and ill submit a pull request with changes.
Thanks.
@ctrleffive This seems to solve the issue for me. I added the stickers pack and deleted it more than 5 times and no error arises.
avoid_cache
field was also missing.
"image_data_version": "1"
was added on this update.
As whatsapp stickers documentation says that are not optinoal fields, so I think this issue is solved...
@vincekruger tell us when update your plugin, thanks.
avoid_cache
field was also missing.
@grayknight2 yeh. but without that field also the plugin works. anyway, ill update the documentation and the JSON file an submit a pull request.
@ctrleffive Thanks for this.
I've been a little busy with other projects, I will get to this as soon as I have a chance. :)
Push requests are welcome. :)
@ctrleffive Thanks for this.
I've been a little busy with other projects, I will get to this as soon as I have a chance. :)
Push requests are welcome. :)
Anticipating.
Hey guys. I think I found a solution to the issue.
What I did was
- replacing the whole
sticker_packs
folder contents with this -> https://github.com/WhatsApp/stickers/tree/master/Android/app/src/main/assets- renamed
contents.json
tosticker_packs.json
- added
sticker_packs/sticker_packs.json
&sticker_packs/1/
toassets
inpubspec.yaml
(this is not mentioned in the documentation)flutter clean
flutter run
I found out
"image_data_version": "1"
property was missing in the JSON file. Let me know if this solved the issue and ill submit a pull request with changes. Thanks.
I think it's a partial fix, this only works well if you will add one sticker pack. This does not fix the issue with dynamically generated stickers. You still have to restart the app before WhatsApp can see the second generated sticker pack after adding the first one.
@ahkohd I don't really understand your issue, could you please elaborate?
@ahkohd I don't really understand your issue, could you please elaborate?
I am developing a sticker app that you can use to make new stickers and add them to WhatsApp. Therefore at the start of the app, there is no sticker_pack.json file, it's dynamically generated with the other sticker related props, then I use this plugin to send it to Whatsapp. Basically on every export to Whatsapp, you will overwrite the existing sticker props (folders, .json, .webp, .png) with newly generated ones.
The problem is after I generate the first sticker pack and send it to WhatsApp, it works, but it won't work again if you try to export another sticker pack to Whatsapp (Third party pack cannot be found likely because the corresponding app is restricted, sdk: 23 ,power saving mode: false). You have to restart the app.
I have spent days trying to fix this issue but no luck since then. 😓
My observations:
I meet the same problem _listener I/flutter ( 7068): StickerPackResult.ERROR I/flutter ( 7068): true I/flutter ( 7068): Third party pack cannot be found likely because the corresponding app is restricted, sdk: 28 ,power saving mode: false
first,it work ,well, but, only first,It didn't work except for the first time
I meet the same problem _listener I/flutter ( 7068): StickerPackResult.ERROR I/flutter ( 7068): true I/flutter ( 7068): Third party pack cannot be found likely because the corresponding app is restricted, sdk: 28 ,power saving mode: false
first,it work ,well, but, only first,It didn't work except for the first time
Add these fields to each sticker package "avoid_cache": false, "image_data_version": "1" And all will work fine
@xdeni I tried as you said, but it didn't work
class StickerState extends State<StickerWidget>{
void initState(){
for(var i=0;i<widget.iconList.length;i++){
widget.iconList[i]["checked"] = false;
}
}
String _platformVersion = 'Unknown';
bool _whatsAppInstalled = false;
bool _whatsAppConsumerAppInstalled = false;
bool _whatsAppSmbAppInstalled = false;
bool _stickerPackInstalled = false;
String platformVersion;
WhatsAppStickers _waStickers;
Future<void> initPlatformState() async {
_waStickers= WhatsAppStickers();
try {
platformVersion = await WhatsAppStickers.platformVersion;
} on PlatformException {
platformVersion = 'Failed to get platform version.';
}
if (!mounted) return;
bool whatsAppInstalled = await WhatsAppStickers.isWhatsAppInstalled;
bool whatsAppConsumerAppInstalled =
await WhatsAppStickers.isWhatsAppConsumerAppInstalled;
bool whatsAppSmbAppInstalled =
await WhatsAppStickers.isWhatsAppSmbAppInstalled;
_stickerPackInstalled =
await _waStickers.isStickerPackInstalled(widget.packid);
setState(() {
_platformVersion = platformVersion;
_whatsAppInstalled = whatsAppInstalled;
_whatsAppConsumerAppInstalled = whatsAppConsumerAppInstalled;
_whatsAppSmbAppInstalled = whatsAppSmbAppInstalled;
});
}
void dispose(){
super.dispose();
}
Map getJSONFile(){
List stickers = [];
for(var i=1;i<widget.iconList.length;i++){
stickers.add({
"image_file": widget.iconList[i]["img"],
});
}
Map jsonfile = {
"android_play_store_link": "",
"ios_app_store_link": "",
"sticker_packs":[
{
"identifier":widget.packid,
"name":widget.name,
"publisher": "Example Sticker Pack",
"tray_image_file":widget.iconList[0]["img"],
"publisher_email":"",
"publisher_website": "",
"privacy_policy_website": "",
"license_agreement_website": "",
"image_data_version":"1",
"avoid_cache": false,
"stickers":stickers
}
]
};
return jsonfile;
}
void addToWhatsapp () async {
initPlatformState();
String dir = (await getApplicationDocumentsDirectory()).path;
Directory stickersDirectory = Directory("$dir/sticker_packs");
if (!await stickersDirectory.exists()) {
await stickersDirectory.create();
}
File jsonFile = File('$dir/sticker_packs/sticker_packs.json');
String content = jsonEncode(getJSONFile());
jsonFile.writeAsStringSync(content);
var content2 = await jsonFile.readAsStringSync();
String url = stickersDirectory.path;
String packid = widget.packid;
Directory num = Directory("$url/$packid");
if(!await num.exists()){
await num.create();
}
String url2 = num.path;
for(var i=0;i<widget.iconList.length;i++){
String img = widget.iconList[i]["img"];
File info = new File("$dir/$img");
info.copySync('$url2/$img');
}
_waStickers.addStickerPack(
packageName: WhatsAppPackage.Consumer,
stickerPackIdentifier: widget.packid,
stickerPackName: widget.name,
listener: _listener,
);
}
@override
Widget build(BuildContext context) {
return
Column(
children: <Widget>[
Container(
height:500,
margin: EdgeInsets.only(top:20),
child: GridView(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4, //横轴三个子widget
childAspectRatio: 1//宽高比为1时,子widget
),
children:widget.iconList.map((f){
return Column(
children: <Widget>[
SizedBox(
width:60,
child: Image(image:
NetworkToFileImage(
url: iconUrl+f['img'],
file: fileFromDocsDir(f["img"]))),
)
],
);
}).toList()
),
),
Container(
width:200,
height:50,
decoration: BoxDecoration(
color: Color(0xFFc3185e),
borderRadius: BorderRadius.all(Radius.circular(25))
),
child: FlatButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25)
),
color:Color(0xFFc3185e) ,
child: Text("ADD TO WHATSAPP",
style:TextStyle(
color: Colors.white
)),
onPressed: () async{
addToWhatsapp();
},
),
),
],
);
throw UnimplementedError();
}
Future<void> _listener(StickerPackResult action, bool result,
{String error}) async {
print("_listener");
print(action);
print(result);
print(error);
}
}
I've finally fixed the problem!!! Update coming soon.
@vincekruger thanks for the update. Awesome!
hi @ahkohd, I am developing a sticker app that the user download the stickers that it want from my server. it seems that you developed, i think. How did you do? because i have the same problem "Third party pack cannot be found likely because the corresponding app is restricted, sdk: 30 ,power saving mode: false". I tried for 3 days and i don't know the errror
thanks
Same problem here
Same problem here
I fixed it, There were two problems in my code
android_play_store_link
and ios_app_store_link
had a random URLSame problem here @tonyCruzNagy
How to fix This Error @thisisddzin
Third party pack cannot be found likely because the corresponding app is restricted, sdk: 33 ,power saving mode: false
same problum please fix it
I'm having an issue with the example code so I can't add the stickers to whatsapp: