lschmierer / android_play_install_referrer

A Flutter plugin for the Android Play Install Referrer API.
BSD 2-Clause "Simplified" License
21 stars 21 forks source link

The package name should be passed in as a String to to the plugin to work #15

Closed Asim-2000 closed 3 years ago

Asim-2000 commented 3 years ago

The plugin will only work for you until and unless we change the package name for the caller. Hence, we need to accept it as an argument for the package. and based on the input, we need to give the response.

Following are the details mentioned in the Play Install Referrer API.

image

And this is the implementation of the Channel:

class AndroidPlayInstallReferrer {
  static const MethodChannel _channel =
      const MethodChannel('de.lschmierer.android_play_install_referrer');

It should be something like this

class AndroidPlayInstallReferrer {
  static const MethodChannel _channel =
      const MethodChannel(`$package_name`);
lschmierer commented 3 years ago

I do not see how the name of the Flutter MethodChannel is related to the Install Referrer API. The MethodChannel is only used for communication between the Flutter app and the native plugin.

https://github.com/lschmierer/android_play_install_referrer/blob/master/android/src/main/kotlin/de/lschmierer/android_play_install_referrer/AndroidPlayInstallReferrerPlugin.kt

The channel name itself is arbitrary. It just has to be the same on the Dart side (your cited code) and the Android side (the link above).

Further, your screenshot shows the documentation of the Play Installer AIDL interface (https://developer.android.com/google/play/installreferrer/igetinstallreferrerservice) which is not used in this plugin. Instead we use the Play Installer Java/Kotlin library (https://developer.android.com/google/play/installreferrer/library) which makes it easier to work with from Java/Kotlin. Especially, it does not require us to pass package_name.