Terminate incoming call by TelephonyManager on Android P is not working - xamarin.forms

On Android 8 and below, i'm using TelephonyManager to terminate incoming call. But on android 9, my code is not working.
I found on Google docs, they said that we had an official API for rejecting calls on Android.
https://developer.android.com/reference/android/telecom/TelecomManager#endCall()
But it's Java code. I don't know how to use that method in my xamarin project.
By the way, do we have any way to terminate a phone call programmatically on Android 9?
Please help me. I am new to xamarin.

Related

Can FCM push notifications in Electron App

I'm trying to send notifications from Firebase Cloud Messaging (FCM) to a window app (window form for example) but it doesn't seem to be possible (since fcm only supports android/ios/webapp, for here and here).
So trying building Electron app to be able to receive and display notifications from fcm (slack is built from electron js and also displays notifications, here), and found the electron-push-receiver allowing it to receive notifications from FCM
But it seems that there is no update for a long time, so there is a issue#80
Now is it possible to build electron application that can receive notifications from FCM?
Thank you very much!
I just implemented FCM in my Electron app earlier today by following the guide here:
https://github.com/CydeSwype/electron-fcm-demo
Screenshot of FCM working in an Electron app
I was skeptical at first as well, given that the repo hasn't been updated in a while, but was pleasantly surprised that it still works.
If you have any further questions, go ahead and I'll try to help :)
I also got this working with electron-push-receiver, though I had to do a workaround for more recent versions of Electron.
I looked at the firebase-admin.messaging Node package but that is only for privileged environments.
The HTTP 503 issue you linked it seems was just another outage that has been resolved; I can still register for push notifications with this setup.

Telegram bot hosted in Firebase not responding

I am developing Telegram bot with using Telegraf.js and hosting it using Firebase (as a Function).
When I run it using Firebase Function Emulators on my local everything is fine and working well. But once I deploy the function, it will only work for few minutes and after awhile (like 15+ minutes) it stops responding.
The part I not understand is that, once I create a Firebase Function that will send user a message using chat_id, it'll start responding for a few minutes.
Seems like the bot is not responding after idle for awhile, I super new with Telegram Bot, any articles or hints would really help me right now.
The code would be super basic like
bot.on(['sticker', 'photo'], (ctx) => ctx.reply('Cool! 👍'))
Reference to this issues: https://github.com/telegraf/telegraf/issues/98
I was using polling method (getUpdates) which will cause a timeout issue in Firebase server, I change to using Webhook instead.

Firebase Cross Platform Push Notification Plugin Duplicating MainActivity

I'm using the following plugin for implementing and handling FCM push notifications in my xamarin application and there's one little unaddressed problem I'm facing.
I was hoping someone else has already figured it out and could help me.
THE PROBLEM:
It seems to be duplicating my MainActivity although I have the LaunchMode set to SingleTop.
There's an event called OnNotificationReceived that's provided by the library.
This event fires as expected, only once, when the application is in the foreground.
When I minimize the application (let it run in the background), send a notification to the device and tap on the notification, it opens the application, as expected, but if I send another notification after that, while the application is in the foreground, The OnNotificationReceived Event is fired twice.
I've tried changing the NotificationActivityFlags property to SingleTop.
I've tried changing my MainActivity's Launch Mode to SingleTop
I tried running the sample application they've provided to check if its something that I'm doing wrong, and still the same thing happens.
Logging the issue in their Github repository
None of the above have worked.
The issue can be reproduced by:
downloading the sample from the repository, link provided above
replacing their google-services.json file with your own from the Firebase
console.
change the package name of the sample of the application to the one you
have registered on Firebase
following the steps above that I've mentioned
ADDITIONAL INFO
Version Number of Plugin: 1.3.0
Device Tested On: Huawei P8 Lite Android Version 6.0
Version of VS: Visual Studio 2019
Version of Xamarin: 3.4.0.1009999
Update:
Unfortunately, the method below has not proven successful after attempting to implement it, I should have thought of the fact that I'm still going to need the notification object for iOS, earlier.
Myself and the team are going to implement a way to keep track of the users platform on the server and send them a notification either with or without the notification based on their platform, since iOS handles FCM notifications differently from Android. For now we're going to use Google's Instance ID service to determine what platform existing users are on.
Workaround:
I hope this helps someone in the future, if not I hope someone can provide me with a better solution.
In order to have my cake and eat it, basically be able to keep the notification object in the payload instead of removing it and having to further customise the payload to display notifications just for iOS, I changed the MainActivity's (the activity thats launched when a user taps on the notification) Launch mode to SingleInstance. That way I can keep my notification object in the payload and not have to worry about the OnNotificationReceived event being triggered twice.

FCM console push test is currently broken? (Android)

I've been using FCM console(web) to test push notification for Android smartphone.
I use push token from Android device, but FCM console says "Completed" and it's not delivered.
It worked fine before, but recent few days, it's not working.
Is there anyone facing same problem?
I got an answer from FCM support team.
Thank you for that information.
It would seem that you are affected by the changes made between July
31 and August 1st. We rolled out a change to Firebase Notifications to
filter apps by GMP App Id rather than by package name. This change was
purely internal and should have had no effect on visible behavior as
all apps using Firebase should have had both package name and app id
set to match. However, we are now seeing some apps that have the wrong
app id set and this is causing messages to not be delivered (or in
some cases to be delivered to the wrong app if an app has the app id
of another app). These apps have a bug that was previously masked but
is now exposed.
We are investigating ways in which apps have sent these incorrect app
ids and ways in which we can catch them and warn app developers.
For now, the Firebase Notifications console will only work with apps
that use the FCM SDK. We recommend updating to the latest version of
the FCM SDK in order to mitigate the issue, but in case you don't want
to migrate to FCM SDK, you can still use your own server to send push
notifications.
Apologies for the inconvenience this may have caused. Please let me
know if there's anything else I could help with.
Regards,

Xamarin's implementation of FCM update broke data messages on iOS 11 and Xamarin

I updated my project's Firebase packages, including Cloud Messaging, with 2.0.0 release. Now I see that iOS 11 devices do not receive data messages from FCM. Unlike this thread, I have no problems receiving notifications via APNs with Firebase.
I implemented every necessary change, including replacing the old Messaging.SharedInstance.Connect() method with Messaging.SharedInstance.ShouldEstablishDirectChannel = true;.
I have tried to implement the IMessagingDelegate's methods ApplicationReceivedRemoteMessage and DidReceiveMessage - both separately and together. neither hits breakpoints.
The Xamarin guys have not updated the guideline here as of this question's writing. Has anyone else encountered this issue? What can be done?

Resources