HarshAndroid / FreeVPN-App-Flutter

Free Vpn App Made with OpenVPN Protocol & Flutter and Dart.
149 stars 54 forks source link

When click on notification app doesn't start #4

Closed kashiflab closed 1 year ago

HarshAndroid commented 1 year ago

Actually that notification is just for showing vpn connection details. If you want to handle click on it then you need to modify notification codes in java (vpn library created by Nizwar and we imported).

File that contains notification codes: https://github.com/HarshAndroid/FreeVPN-App-Flutter/blob/master/android/vpnLib/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java

kashiflab commented 1 year ago

I tried to call mainactivity intent but it's not working even though I checked the flags as well. Can you please tell me, how can I achieve this? @HarshAndroid

HarshAndroid commented 1 year ago

Actually I don't know much of Java but there is something call PendingIntent in Java. You need to create it & then pass as argument in notification while creating it.

Example Codes: //Sample code to create pending intent PendingIntent contentIntent = new PendingIntent.getActivity(this, 0, intent, flag); (You need to research about flag parameter a bit).

//for adding to notification before build .setContentIntent(contentIntent)

kashiflab commented 1 year ago

that's what i actually did but MainActivity is not present in the lib and need to pass it as a module. thanks for you help