Skip to content

[Bug report] Broadcast error when supporting SDK 34 #695

@arbelkf

Description

@arbelkf

SDK 34 changed the way android interacts with Broadcast.
when asking to download the model on cellular data - I get this error.

loadTesnsor::java.lang.SecurityException: com.xxx.xxxx: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for
system broadcasts

https://developer.android.com/guide/components/broadcasts#context-registered-receivers

this is the full code:

               DownloadConditions.Builder downloadConditionsBuilder = new DownloadConditions.Builder();
               allowOnlyOnWifiModel = false;
                if (allowOnlyOnWifiModel)
                 {
                     downloadConditionsBuilder.requireWifi();
                     AppendLogDebug("remote model :: require Wifi");
               }
               else
                 AppendLogDebug("remote model :: allow also cellular");
             DownloadConditions downloadConditions = downloadConditionsBuilder.build();                     

            RemoteModelManager.getInstance().isModelDownloaded(remoteModel)
                    .addOnSuccessListener(aBoolean -> {
                        if (!aBoolean)
                        {
                            RemoteModelManager.getInstance().download(remoteModel, downloadConditions)
                                    .addOnSuccessListener(new OnSuccessListener<Void>() {
                                        @Override
                                        public void onSuccess(Void unused) {
                                            RemoteModelManager.getInstance().isModelDownloaded(remoteModel)
                                                    .addOnSuccessListener(aBoolean -> {
                                                        tensorDownloaded = aBoolean;
                                                        AppendLogError("loadTesnsor::tensor model loaded::3");
                                                    });
                                        }
                                    })
                                    .addOnFailureListener(new OnFailureListener() {
                                        @Override
                                        public void onFailure(@NonNull Exception e) {
                                            AppendLogError("loadTesnsor::" + e.toString());
                                            tensorLoadOnce.set(false);
                                            ToastMeVeryShort("Wifi needed for first downloading of models", true);
                                        }
                                    });
                        }
                        else
                        {
                            tensorDownloaded = aBoolean;
                            AppendLogError("loadTesnsor::tensor model loaded::3");
                        }
                    });

if you have any workaround or information, please advice.
Google billing library just fixed this error a week ago in version 6.0.1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions