0xf104a / NextcloudServices

Android app to send notifications from Nextcloud without using GCM(Google cloud messaging)
GNU General Public License v3.0
63 stars 11 forks source link

Unable to create `NotificationPollService` on 1.1-beta18 #77

Closed AlexBreedveld closed 6 months ago

AlexBreedveld commented 6 months ago

The latest release has totally broken the app, crashing right on startup.

Logs:

FATAL EXCEPTION: main
Process: com.polar.nextcloudservices, PID: 27893
java.lang.RuntimeException: Unable to create service com.polar.nextcloudservices.Services.NotificationPollService: java.lang.SecurityException: com.polar.nextcloudservices: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:4705)
    at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2289)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:205)
    at android.os.Looper.loop(Looper.java:294)
    at android.app.ActivityThread.main(ActivityThread.java:8248)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
Caused by: java.lang.SecurityException: com.polar.nextcloudservices: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
    at android.os.Parcel.createExceptionOrNull(Parcel.java:3057)
    at android.os.Parcel.createException(Parcel.java:3041)
    at android.os.Parcel.readException(Parcel.java:3024)
    at android.os.Parcel.readException(Parcel.java:2966)
    at android.app.IActivityManager$Stub$Proxy.registerReceiverWithFeature(IActivityManager.java:5713)
    at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1852)
    at android.app.ContextImpl.registerReceiver(ContextImpl.java:1792)
    at android.app.ContextImpl.registerReceiver(ContextImpl.java:1780)
    at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:755)
    at com.polar.nextcloudservices.Notification.NotificationController.<init>(NotificationController.java:44)
    at com.polar.nextcloudservices.Services.NotificationPollService.onCreate(NotificationPollService.java:113)
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:4692)
    ... 9 more
Caused by: android.os.RemoteException: Remote stack trace:
    at com.android.server.am.ActivityManagerService.registerReceiverWithFeature(ActivityManagerService.java:14008)
    at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2585)
    at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2763)
    at android.os.Binder.execTransactInternal(Binder.java:1358)
    at android.os.Binder.execTransact(Binder.java:1304)
0xf104a commented 6 months ago

Hello. Thankyou for reporting the issue! Can you please specify Android version you are using app on?

0xf104a commented 6 months ago

It seems you are using A14 :) This error introduced since A14(https://stackoverflow.com/questions/77235063/one-of-receiver-exported-or-receiver-not-exported-should-be-specified-when-a-rec) Unfortunately I do not have A14 device yet, though I would implement fix now

0xf104a commented 6 months ago

@AlexBreedveld can you please test the fix on your device? You can download debug APK here

AlexBreedveld commented 6 months ago

@AlexBreedveld can you please test the fix on your device? You can download debug APK here

With the compiled APK you've provided it is still crashing. And yes, I am using Android 14. I can try to implement a fix later today, as you've said that you don't have an Android 14 device to test with.

FATAL EXCEPTION: main
Process: com.polar.nextcloudservices, PID: 2485
java.lang.RuntimeException: Unable to create service com.polar.nextcloudservices.Services.NotificationPollService: android.app.MissingForegroundServiceTypeException: Starting FGS without a type  callerApp=ProcessRecord{2c4a494 2485:com.polar.nextcloudservices/u0a500} targetSDK=34
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:4705)
    at android.app.ActivityThread.-$$Nest$mhandleCreateService(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2289)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:205)
    at android.os.Looper.loop(Looper.java:294)
    at android.app.ActivityThread.main(ActivityThread.java:8248)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
Caused by: android.app.MissingForegroundServiceTypeException: Starting FGS without a type  callerApp=ProcessRecord{2c4a494 2485:com.polar.nextcloudservices/u0a500} targetSDK=34
    at android.app.MissingForegroundServiceTypeException$1.createFromParcel(MissingForegroundServiceTypeException.java:53)
    at android.app.MissingForegroundServiceTypeException$1.createFromParcel(MissingForegroundServiceTypeException.java:49)
    at android.os.Parcel.readParcelableInternal(Parcel.java:4870)
    at android.os.Parcel.readParcelable(Parcel.java:4852)
    at android.os.Parcel.createExceptionOrNull(Parcel.java:3052)
    at android.os.Parcel.createException(Parcel.java:3041)
    at android.os.Parcel.readException(Parcel.java:3024)
    at android.os.Parcel.readException(Parcel.java:2966)
    at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:6790)
    at android.app.Service.startForeground(Service.java:775)
    at com.polar.nextcloudservices.Services.NotificationPollService.onCreate(NotificationPollService.java:124)
    at android.app.ActivityThread.handleCreateService(ActivityThread.java:4692)
    ... 9 more
0xf104a commented 6 months ago

@AlexBreedveld can you please test once more? I have fixed the manifest. You can download APK here

AlexBreedveld commented 6 months ago

12_03-11-11-28_627.log

That worked! I've attached the logs of the app after a fresh install on my device.

0xf104a commented 6 months ago

Thankyou very much for testing!