nizwar / openvpn_flutter

A package that allow you to connect OpenVPN service with Flutter
https://pub.dev/packages/openvpn_flutter
GNU General Public License v3.0
85 stars 99 forks source link

Kotlin example code for new users #98

Closed chall3ng3r closed 5 months ago

chall3ng3r commented 8 months ago

Just wanted to suggest small update. New app created with Flutter doesn't contain all the required imports and a complete override example shows how it should like in final form inside class.

The Kotlin suggested example code:

import android.content.Intent
import id.laskarmedia.openvpn_flutter.OpenVPNFlutterPlugin

class MainActivity: FlutterActivity() {
    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        OpenVPNFlutterPlugin.connectWhileGranted(requestCode == 24 && resultCode == RESULT_OK)
        super.onActivityResult(requestCode, resultCode, data)
    }
}