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
84 stars 95 forks source link

Kotlin example code for new users #98

Closed chall3ng3r closed 4 months ago

chall3ng3r commented 7 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)
    }
}