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
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
package com.columnapp.plugins.metapixel;

import android.util.Log;
import android.content.Context;
import com.facebook.appevents.AppEventsLogger;

public class MetaPixel {
public String getAnonymousID() throws NoSuchMethodException {
throw new NoSuchMethodException("Method not implemented");
private final Context context;

public MetaPixel(Context context) {
this.context = context.getApplicationContext();
}

public String getAnonymousID() {
return AppEventsLogger.getAnonymousAppDeviceGUID(context);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@
@CapacitorPlugin(name = "MetaPixel")
public class MetaPixelPlugin extends Plugin {

private MetaPixel implementation = new MetaPixel();
private MetaPixel implementation;

@Override
public void load() {
implementation = new MetaPixel(getContext());
}

@PluginMethod
public void getAnonymousID(PluginCall call) throws NoSuchMethodException {
public void getAnonymousID(PluginCall call) {
JSObject ret = new JSObject();
ret.put("value", implementation.getAnonymousID());
call.resolve(ret);
Expand Down