NativeScript / NativeScript/plugins

[@nativescript/background-http] packagename - illegal argument exception

Abierto
#517 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
TypeScript
Estrellas
206
Forks
123
Merge medio
2 d 1 h
PR fusionados (30 d)
1

Descripción

Issue Description

Hi guys,

When I try to use your background http to upload a file,

I noticed I am getting :
Exception java.lang.RuntimeException: Unable to create service net.gotev.uploadservice.UploadService: java.lang.IllegalArgumentException: You have to set namespace to your app package name (context.packageName) in your Application subclass at android.app.ActivityThread.handleCreateService (ActivityThread.java:5086) at android.app.ActivityThread.-$$Nest$mhandleCreateService at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2428) at android.os.Handler.dispatchMessage (Handler.java:106) at android.os.Looper.loopOnce (Looper.java:226) at android.os.Looper.loop (Looper.java:313) at android.app.ActivityThread.main (ActivityThread.java:8757) at java.lang.reflect.Method.invoke at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:571) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067) Caused by java.lang.IllegalArgumentException: You have to set namespace to your app package name (context.packageName) in your Application subclass at net.gotev.uploadservice.UploadServiceConfig.getNamespace (UploadServiceConfig.kt:74) at net.gotev.uploadservice.UploadServiceConfig.getBroadcastNotificationAction (UploadServiceConfig.kt:234) at net.gotev.uploadservice.UploadServiceConfig.getBroadcastNotificationActionIntentFilter (UploadServiceConfig.kt:248) at net.gotev.uploadservice.observer.request.NotificationActionsObserver.register (NotificationActionsObserver.kt:31) at net.gotev.uploadservice.UploadService.onCreate (UploadService.kt:194) at android.app.ActivityThread.handleCreateService (ActivityThread.java:5073)

This is because in this file:
https://github.com/NativeScript/plugins/blob/main/packages/background-http/index.android.ts
line 30, we pass in the Utils.android.getApplication()
but the inner method is looking for Utils.android.getApplication().packageName, whereas we get the packageName by Utils.android.getApplication().getPackageName() which can be null/empty, not sure if this is a bug?

Reproduction
  1. uploadFile
  2. close the app and reopen
  3. app crash.
Relevant log output (if applicable)

No response

Environment

No response

Please accept these terms

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Empieza en packages/background-http/index.android.ts, alrededor de la línea 30, donde se pasa Utils.android.getApplication(), y compara ese valor con el acceso al nombre del paquete descrito en el informe. Reproduce la secuencia de uploadFile, cerrar y volver a abrir; el trabajo está terminado cuando la aplicación ya no se bloquea con la namespace IllegalArgumentException.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
android, typescript
Área
mobile
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.