WebEferen / flutter_wallet_card

Flutter Wallet Card plugin (iOS & Android)
MIT License
11 stars 21 forks source link

MissingPluginException(No implementation found for method addWalletCard on channel flutter_wallet_card)on Android #12

Open MostaM0 opened 10 months ago

MostaM0 commented 10 months ago

Hey there, I am trying to run the example app provided with the library but it keeps giving me this error when I run it on android:

E/flutter (22679): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method addWalletCard on channel flutter_wallet_card)

It works fine on an IOS device, what exactly is the expected behaviour on Android ?

WebEferen commented 10 months ago

Hi @MostaM0.

Currently I have removed Android (Google Wallet) integration option due to changed implementation. It is on my current bucket list to get it working. Hopefully by the end of Novemeber it will be ready.

Sorry for unfortunate delay.

MostaM0 commented 10 months ago

No problem, thanks a lot for you efforts. Looking forward for the Android feature.

rashedswen commented 9 months ago

@WebEferen can I work on implementing android?

WebEferen commented 9 months ago

Hi @rashedswen, sure! That would be awesome. Last couple weeks I was busy so that I haven't enough time to finish the Android part.

Feel free to adjust the code and add the channel methods for an Android :)

arielCloudX commented 5 months ago

Hello everyone, Has there been any progress in the implementation of Google Wallet?

I appreciate any news you can provide.

WebEferen commented 5 months ago

There's no updates from the Android yet. This is on my bucket list with version 4 which is upcoming (Q2 2024).

sgaabdu4 commented 2 months ago

Hi @WebEferen,

Do you have any plans to add this functionality? I believe you can now add pkpass files to Google Wallet. (See: Google Wallet Support)

These are the steps I followed to create it within Google Wallet. This might give you some inspiration.

Honestly, I really appreciate what you've done so far!

Changes to AndroidManifest.xml:

1. Added tools namespace and added package bundle:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          package="com.example.com">

2. Added permissions:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>

3. Added FileProvider within the tag:

<provider
    android:name="androidx.core.content.FileProvider"
    android:authorities="${applicationId}.fileProvider"
    android:exported="false"
    android:grantUriPermissions="true"
    tools:replace="android:authorities">
    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/filepaths"
        tools:replace="android:resource" />
</provider>

Added filepaths.xml under android/app/src/main/res/xml:

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
  <files-path name="files-path" path="../" />
</paths>

Code Changes

The packages I used were open_file_plus, permission_handler and path_provider.

final permissionValue = await Permission.manageExternalStorage.request();
if (permissionValue.isGranted) {
  final directory = await getTemporaryDirectory();
  final filePath = '${directory.path}/pass.pkpass';

  // Write the Uint8List to the file
  final file = File(filePath);
  await file.writeAsBytes(fileFromDatabase);

  // Open the .pkpass file
  final openpass = await OpenFile.open(
    filePath,
    type: 'application/vnd.apple.pkpass',
  );
  print(openpass.type);
}