Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ rootProject.allprojects {
apply plugin: 'com.android.library'

android {
namespace="com.example.vungle"
compileSdkVersion 31

defaultConfig {
Expand All @@ -43,4 +44,4 @@ dependencies {
// Optional Google Play Services
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
implementation 'com.google.android.gms:play-services-location:21.0.1'
}
}
3 changes: 1 addition & 2 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.vungle.plugin.flutter.vungle">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:node="remove"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
import io.flutter.plugin.common.PluginRegistry.Registrar;

/** VunglePlugin */
public class VunglePlugin implements FlutterPlugin, MethodCallHandler {
Expand All @@ -41,39 +40,21 @@ public class VunglePlugin implements FlutterPlugin, MethodCallHandler {
consentStatusToStr.put(Vungle.Consent.OPTED_OUT, "Denied");
}

/** v1 Plugin registration. */
public static void registerWith(Registrar registrar) {
final MethodChannel channel = new MethodChannel(registrar.messenger(), channelName);
channel.setMethodCallHandler(new VunglePlugin(registrar.context(), channel));
}

/** v2 Plugin registration */
private static void setup(VunglePlugin plugin, BinaryMessenger binaryMessenger) {
plugin.channel = new MethodChannel(binaryMessenger, channelName);
plugin.channel.setMethodCallHandler(plugin);
}

@Override
public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) {
this.context = binding.getApplicationContext();
setup(this, binding.getBinaryMessenger());
this.channel = new MethodChannel(binding.getBinaryMessenger(), channelName);
this.channel.setMethodCallHandler(this);
}

@Override
public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
this.context = null;
this.channel.setMethodCallHandler(null);
this.channel = null;
}

public VunglePlugin() {
// All Android plugin classes must support a no-args
// constructor for v2.
}

private VunglePlugin(Context context, MethodChannel channel) {
this.context = context;
this.channel = channel;
}

@Override
public void onMethodCall(MethodCall call, Result result) {
if (call.method.equals("getPlatformVersion")) {
result.success("Android " + android.os.Build.VERSION.RELEASE);
Expand Down Expand Up @@ -216,10 +197,6 @@ private void callIsAdPlayable(MethodCall call, Result result) {
}
}

private void callGetConsentStatus(MethodCall call, Result result) {

}

private void callUpdateConsentStatus(MethodCall call, Result result) {
String consentStatus = call.argument("consentStatus");
String consentMessageVersion = call.argument("consentMessageVersion");
Expand Down