Ionic 5 + Capacitor with Huawei HMS - capacitor

I've build an app using Ionic 5 (Angular) and Capacitor. I'm using the Capacitor plugin for Push Notifications. All is working fine on both iOS and Android. However on Huawai phones (P30 and later) things don't work properly.
No device id is obtained and Push Notifications don't work, even the PushNotifications.addListener('registration', async (token: PushNotificationToken) => {}) is not triggered.
Any ideas on what I need to do so that I can maintain one codebase and make it work on both Android "worlds" (Google & Huawei) ?
Thanks in advance,
Chris

Probably the Ionic plug-ins you used are provided for GMS and Firebase so that their capabilities can be directly called in Ionic. Therefore, apps developed by Ionic must directly call HMS capabilities when Google Play services are unavailable.
You are advised to use HMS Ionic plugin to integrate HMS Push Kit in Ionic App. You can get the Push Plugin from here. Please use 5.0.0 version.
Or you can get it from npmjs here.
Update:
If you look for a way which allows you to use both push notifications in the same application by detecting the device type and acting accordingly, you can use G+H solution. Using the G+H approach, you are able to maintain one codebase and decide whether to use GMS or HMS based on the availability of either one.
From: https://stackoverflow.com/a/63337530/13329100

Related

Huawei App Gallery - An app don't appear to some of users

Unfortunately, some of the users could not access the app when they search about it and if they use the app link to reach it the app appears but the install button is disabled
Please can you check what are devices the application is not available.
If the application unavailable for HMS devices, that means there is a Strong dependency on GMS (Google mobile services). So it will be available for download only GMS supporting devices. If you want to make it available on all devices, please integrate HMS services by implementing G+H approach so that it will be available on GMS and HMS devices.
Please follow the below link to integrate hms services with G+H approach:
https://forums.developer.huawei.com/forumPortal/en/topic/0201200435859940059
If only integration of HMS is needed, please refer to: https://developer.huawei.com/consumer/en/doc/development/HMSCore-Library/android-sdk-download-0000001064112371

Check if my ionic app has a new version on AppStore and PlayStore

I would like to add functionality to my Ionic based application to check the respective app store for a newer version, and if present, prompt the user to download once (not repeatedly- they should be able to skip and not be nagged). Similar to Siren, but for Ionic and both Google Play and Apple App Store. I see this similar request for native apps and AppStore and this similar request for Play Store, but nothing specific to Ionic. I feel like I could stitch it together using App Version and ajax calls listed from those requests, but that there has to be other people who have done this already and have existing Cordova/Capacitor plugins for this. Also that there may be nuance that a naive solution could fail (ie ajax call fails, app stores change API, newer version is not supported on device, etc).
Is there an existing plugin or code that will implement the behavior described above?
You can use Market plugin in addition to the App version plugin..
I haven't come across a solution which directly checks the app store, instead i have to maintain the app version in my server db and check it at app start.
Here is the flow that can be used..
App Launches
Checks the current app version using APP VERSION plugin
Calls an API endpoint to my server to compare for the deployed app store version (which is maintained in the db)
If the app version is outdated, use the MARKET plugin to take the user to the app store.
A Capacitor alternative to the market plugin is there, but didn't test it out.
Follow Capacitor plugins proposals, for an upcoming solution.

How to integrate Huawei Mobile Services (HMS) in Unity?

I've found a lot of guidelines on how to integrate HMS in my apps. But majority of them are different or using android studio. May I know which one is the latest guidelines to integrate HMS in my apps for Unity.
Also, I want to enable In-App-Purchase (subscription) for my apps as well.
Thanks in advance.
UPDATED
Currently I'm trying to implement In-App-Purchase for huawei. Huawei tech said that users need to signIn first before they can use IAP. But I received this error while testing signIn
How to obtain product info ? here
AFAIK you have two main options:
UDP SDK from Unity, which is the Unity official solution to HMS in Unity. However has been under maintenance for some days now.
Unity HMS Plugin from EvilMinds, an open source alternative that is already functional and includes supports to more HMS kits. Looks pretty promising for the future.
In any case you can still manually access HMS Android SDK directly using Unity SDK Android API.
Unity provides the HMS Plugin here: Unity Asset Store > Huawei HMS Core App Services
The README file contains information about development guides, API references. For more technical questions, please submit a ticket with Unity Customer Service.
Currently Unity does not support the In-App-Purchase (subscription) function. It will be planned in the future.
Update:
For the IAP error:
It is a null pointer. Please check for unassigned objects. If you cannot find anything, please delete project and install again cause sometimes these kind of things happening.

Flutter. Admob ads with mediation

I've integrated https://pub.dev/packages/firebase_admob into my app and implemented rewarded ads. My problem now is that I'd like to use mediation via this plugin. The only thing is that I know (from developing Android apps and also it says in the Admob docs) that one needs to include the mediated networks' SDKs in the app.
Does this plugin even support mediation? I wasn't able to find anything relating to this.
Or does the mediation only come from the admob dashboard, just by setting up the add-unit with mediation and you're not really required to add the SDKs?
I couldn't find any adapters for this plugin, so ... don't really have anything to integrate in the app.
I'm very confused. Does anyone know how to use mediation or if it even works with the current firebase_admob` flutter plugin?
You can use firebase_admob and that dependency supports mediation. You you would like to add mediation there is a guide over here:
Android - https://developers.google.com/admob/android/mediate
iOS - https://developers.google.com/admob/ios/mediate
You can select the ad network you would like to integrate and read the steps on how to do so. Sometimes the documentation can be outdated so just make sure you cross-check the steps with the ad network you want to integrate on their github repo.
If you are integrating it for Android you have to add the dependencies in your app level build.gradle file and it will automatically install that particular ad networks SDK in your Flutter app.
If you are adding the same for iOS just install the Cocoapod for the ad network at the end of your Podfile.

How to update flutter app programmatically in Play/App store?

There is an upgrader (mostly for iOS) and in_app_update plugin (for android). I try to implement them both and had a difficulty to do so. I post and issues in both plugin but I got no response. So if anyone use this 2 plugin successfully please can you share step-by-step approach details.
Basically How to update flutter app programmatically in Google Play Store (Android) & App Store (iOS)?
Thanks
I have also tried in_app_update 1.1.11 and upgrader 2.4.0.
For upgrader:
I also don't know how to use Appcast, so I use the iTune api to get my app version in the App Store then pop up the install dialog. However, the iTune api is so slow to update. Therefore I just use Firebase remote config to set the version once the app is published.
For in_app_update:
I also don't know how to use it. I have add the Play Core in app/build.gradle
implementation 'com.google.android.play:core:1.8.0'
Nothing pop up even I downloaded the old version from the Play Store and then publish a new version.
Update:
I found that in_app_update actually work just by following its example code. I don't have any update pop up before because my Android device is Mi 9, seems there is some bug in it. The update pop up can be seen in the release version of other brand of devices
Since I really want to use the Play Store in-app-update, so for android I did use the remote config... waiting for someone to have the guides