Skip to content

[BUG] No static method getForegroundService on Nougat #1508

@syphyr

Description

@syphyr

Describe the Bug
The following commit c9f4e4d contains the method getForegroundService which is not supported on Nougat and causes a Fatal Exception on startup.

To Reproduce
Steps to reproduce the behavior:

  1. Open Orbot
  2. Crash on startup

Expected Behavior
Not crash on startup

What Custom Configuration Do You Use?
If applicable, how did you set up Orbot? Did you configure some settings?

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: T813
  • OS: Nougat
  • Version: edfa066

Crash Logs (Advanced)

12-08 22:38:52.419  4689  4689 E AndroidRuntime: FATAL EXCEPTION: main
12-08 22:38:52.419  4689  4689 E AndroidRuntime: Process: org.torproject.android, PID: 4689
12-08 22:38:52.419  4689  4689 E AndroidRuntime: java.lang.NoSuchMethodError: No static method getForegroundService(Landroid/content/Context;ILandroid/content/Intent;I)Landroid/app/PendingIntent; in class Landroid/app/PendingIntent; or its super classes (declaration of 'android.app.PendingIntent' appears in /system/framework/framework.jar)
12-08 22:38:52.419  4689  4689 E AndroidRuntime: 	at org.torproject.android.service.OrbotService.showToolbarNotification(OrbotService.java:126)
12-08 22:38:52.419  4689  4689 E AndroidRuntime: 	at org.torproject.android.service.OrbotService.onStartCommand(OrbotService.java:150)
12-08 22:38:52.419  4689  4689 E AndroidRuntime: 	at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3351)
12-08 22:38:52.419  4689  4689 E AndroidRuntime: 	at android.app.ActivityThread.-wrap21(ActivityThread.java)
12-08 22:38:52.419  4689  4689 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1601)
12-08 22:38:52.419  4689  4689 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:102)
12-08 22:38:52.419  4689  4689 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:154)
12-08 22:38:52.419  4689  4689 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:6186)
12-08 22:38:52.419  4689  4689 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
12-08 22:38:52.419  4689  4689 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
12-08 22:38:52.419  4689  4689 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)

Additional Context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions