dev7dev / V2ray-Android

A simple Java module with sample source for implementing V2ray/Xray on Android.
47 stars 14 forks source link

Service Notification Not Displaying On First Connection #22

Closed bobycx closed 2 months ago

bobycx commented 3 months ago

There is a bug where after a new installation and on first connect after VPN permissions are granted, the notification service does not display but the app successfully connects to the VPN server. Every other connection works fine with notification service working. Looked into your source code but couldn't find the issue. Annoying bug. Please look into this, thanks in advance!

dev7dev commented 3 months ago

Hello Are you testing our release apk on github releases? What is your test device? We had this bug in the past but I thought it was fixed.

bobycx commented 3 months ago

Yea I am using the latest apk (v6.1813) and my test device is a physical Huawei (model VOG-L04) running Android 10 and EMUI 11.0.0.

v4.1810 also has the same issue

bobycx commented 3 months ago

@dev7dev Could you tell me what you did to try to fix it before? I can try to help you find out why the bug is occurring again. Thanks man.

dev7dev commented 3 months ago

Everything about notifications is in NotificationService class. I don't remember exactly, but I think I added this code to quickly display the notification and the problem was solved on my test devices. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { notifcationBuilder.setForegroundServiceBehavior(NotificationCompat.FOREGROUND_SERVICE_IMMEDIATE); } else { notifcationBuilder.setForegroundServiceBehavior(NotificationCompat.FOREGROUND_SERVICE_DEFAULT); }

bobycx commented 3 months ago

Could you test if the bug exists still on your test devices currently? Trying to see if it is just an issue with my test device or if it's a universal bug. Thanks!

dev7dev commented 3 months ago

I have this device for test : Xiaomi note 8, Xiaomi redmi note 11 , Xiaomi note 13t pro. Samsung s7 edge , Samsung note 20 , Samsung s24 ultra. I have not seen this problem on these devices.