Push Notification didn't appear on Android through Twilio Notify - android

I am learning twilio android push notification, twlio have already provided a 'notifications-quickstart-android' app on github, I cloned it and made the changes as mentioned on the official docs of twilio,
But after creating the binding on android app,
(Also after pressing on register binding, the closes or ithink crashed i think)
documentation says to make a GET/POST request on this URL through Postman/curl and then a notification will appear on app:
https://sturdy-concrete-1657.twil.io/send-notification?identity=user1&body=Hello
I replaced the user1 with user9999 because I created the binding with this user,
Then I made the request through ThunderClient (a VS Code Extension like a postman),
But in the response I got
Not Found
why ?

Related

How to resolve Flutter Agora RTC showing error code 110

Greetings to fellow developers,
I am working on a project where I have to display a functional video call between two users. For reference, I have been following this video https://www.youtube.com/watch?v=v9ngriCV0J0
which has given a step-by-step explanation for establishing a video call between two users.
However, the only issue is that the video is having a Firebase backend. Hence, whenever a caller creates a call model with sender and recipient Ids, the recipient immediately receives the same data and a call is established. Whereas, I am using Node/Express backend (manual API calls for updating fetching data) which makes it extremely difficult to receive the required call data from the receiver's end as soon as the caller sends it to the backend. Also, it will be inefficient to listen for fetching the call data the whole time.
I will be very grateful to all of you if you can help me find a working approach so that the receiver can fetch the required call data as soon as the caller creates it in the backend for establishing a video call from separate devices.
Here's my code
https://pastebin.com/AurJnG27
/***pubspec.yaml dependencies***/
dependencies:
flutter:
sdk: flutter
http: ^0.12.0+2
provider: ^4.3.3
socket_io_client: ^0.9.9
permission_handler: ^3.0.0
agora_rtc_engine: ^1.0.8
/***pubspec.yaml dependencies***/
Please let me know if any further information is required from my side. Any feedback for code improvisation (if you feel like it) is also very appreciated.
You're getting that error because of an incorrect or expired token that you might be using. Firstly, I will suggest shifting to the latest version of the Agora SDK and then build your application.
Now, if you're just testing out the platform then from your Agora dashboard you can go ahead and generate a new App ID and select the testing mode which will disable token. So in your joinChannel() method you can pass null for the token value.
But if your application is live or is in production then go ahead and select the secured mode from your Agora dashboard. Then you will have to generate a token server from a deployed server, you can read more about it here.
Now, coming to the Firebase part. You can actually make this process much simpler by using the Agora RTM SDK. Which allows you to send messages, through this you can send peer message about the call details and hence refer it while making a call. You can have a look at this blog which shows how you can use the RTM SDK to do the same: https://www.agora.io/en/blog/building-your-own-audio-streaming-application-using-the-agora-flutter-sdk/
If you're interested you can have a look at this sample code given here which will help you setup a proper video calling application.
I will also recommend you to join the Agora Slack Channel where you can get help from other Agora developers.

Notification.permission in Xamarin Webview

I am quite new to Xamarin App Development.
I have a web application using FirebaseNotifications. In the webapp I use this javascript code for checking whether notficatons are accepted.
if (Notification.permission !== "granted") {
Notification.requestPermission();
}
This works pretty well, I can then receive notifications using
firebase.initializeApp(firebaseConfig);
const messaging = firebase.messaging();
messaging.onMessage(function (payload) {
//do something
}
BUT, when I call the same website in an XamarinForms WebView, I get an exception, that Notificaton is null. Therefore I can not grant the the permission and not receive any messages.
Any idea?
If you look at the Notification spec: https://developer.mozilla.org/en-US/docs/Web/API/Notification/permission it is not supported in Android WebView nor iOS WebView which Xamarin.Forms uses behind the scenes. This Notification permission request is for web browsers only.
Hence, this Notification permission, is not necessary to receive notifications in Mobile Applications. For a mobile App to receive notifications you need a different type of setup. You can read more about it here: https://learn.microsoft.com/en-us/xamarin/android/data-cloud/google-messaging/remote-notifications-with-fcm?tabs=windows
It will involve you having to install GooglePlayServices and FirebaseMessaging from NuGet and configuring those for each of your platforms your App runs on.
If you want to invoke some native code to set up these notifications when you call some specific JavaScript in your WebApp, check out the documentation on creating a Custom Renderer for your WebView here: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/custom-renderer/hybridwebview#create-the-custom-renderer-on-android

Amazon Pinpoint and Ionic - Push notifications not working when app is in background

I was asked to develop a sample app integrated with Amazon Pinpoint. Since I am not a pro at developing apps, I decided to follow this simple tutorial and develop the app following the steps described in it. The only differences are that, instead of using an emulator, I executed the project in my own cell phone (a Xiaomi Redmi 4x) and instead of GCM, I used Firebase.
At first, it seemed to work perfectly, but when I moved the app to the background and went back to my homescreen, I could no more receive push notifications from my app. When the app is open and running, everytime I send a push notification a pop-up appears with Title "New Notification" and buttons "Ignore"/"View". But when in background, nothing is visible in my system tray!
Also, if someone knows which part of the code is responsible for this notifications, just warn me and I upload it here.
Okay, so after some tests I made it work (not through console, but through CLI). To do so, I followed some steps I found this question, that took me to two other documents: one from Amazon teaching how to send push notifications through CLI and a simple but very detailed tutorial of phonegap-plugin, the plugin used in our Ionic application to process the pushes.
First of all, replace the phonegap-plugin in your app with the master version avaliable in the github link I sent you.
Then, putting all those information together, I figured out how to write a .json file containing the information we need to send the pushes. Here is a sample of the code I used:
{
"MessageRequest": {
"Addresses": {
"YOUR_DEVICE_ADDRESS_HERE": {
"ChannelType": "GCM"
}
},
"MessageConfiguration": {
"GCMMessage": {
"RawContent": "{\"data\":{\"title\":\"StackOverflow rocks!\",\"body\":\"Am I right?\",\"actions\":[ { \"title\":\"Yes!\", \"callback\":\"app.yes\", \"foreground\":true }, { \"title\":\"No!\", \"callback\":\"app.no\", \"foreground\":false }]}}"
}
}
}
}
As you can see, to change the content in the push notificationm, you'll have to edit it's "RawContent". To do so, use the phonegap-plugin tutorial I sent you and find out how to do the alterations you wish.
Last step: once you updated your plugin version AND saved the code above in a .json file (let's call it test.json), you can send it to your phone oppening command line in the folder containing your .json and writting:
aws pinpoint send-messages --color on --region YOUR_SERVICE_REGION --cli-input-json file:///test.json
This should do the trick! Hope it works for you. If any doubts, just let me know!

Square Web API for Android Kills App

I am unable to make a successful connection with the square reader via android request after following documentation found at https://docs.connect.squareup.com/articles/web-api-android
It seems straightforward, but the connection links end up crashing the app or causing it to restart without any error reporting or callback information sent to either S.browser_fallback_url or S.com.squareup.pos.WEB_CALLBACK_URI.
Sample link activated on dev server (127.0.0.1) is: intent:#Intent;action=com.squareup.pos.action.CHARGE;package=com.squareup;S.browser_fallback_url=http://localhost:8080/tb/square;S.com.squareup.pos.WEB_CALLBACK_URI=http://localhost:8080/tb/square;S.com.squareup.pos.CLIENT_ID=secret;S.com.squareup.pos.API_VERSION=v2.0;i.com.squareup.pos.TOTAL_AMOUNT=150;S.com.squareup.pos.CURRENCY_CODE=USD;S.com.squareup.pos.TENDER_TYPES=com.squareup.pos.TENDER_CARD,com.squareup.pos.TENDER_CARD_ON_FILE,com.squareup.pos.TENDER_CASH,com.squareup.pos.TENDER_OTHER;S.com.squareup.pos.REQUEST_METADATA=5a982466e7b46;S.com.squareup.pos.NOTE=This will be a note!;end
For the CLIENT_ID I was instructed to use Application ID found at https://connect.squareup.com/apps/
Firmware on Contactless, Chip reader is 2.9.36 which is connected to the android device via bluetooth.
--edit--
First time through
https://ibb.co/kSBUYH
https://ibb.co/fyUGDH
Second time through
https://ibb.co/duFZ0x
https://ibb.co/i1MUYH
To bring this out of the comments, the issue was missing the web callback URL being registered in the Square Developer Portal.
You want to be sure to register your callback URL(s)
In order for Square Point of Sale to accept a request from your website, Square needs to verify that you have registered a web callback URI for the application in the Application Dashboard.
First, go to the Application Dashboard, then click on the Point of Sale API tab of your application's settings. Under the Web section, specify your app's web callback URI under the corresponding field.
If your transaction does not succeed for any reason, you should be receiving a error back to you.

Push Messages for PhoneGap

I created an app for iPhone and Android using Phonegap.
Now I wanted to add push functionality which already works pretty good.
When a push message arrives on my iPhone I get a message on the homescreen. If I swipe it, iOS will open my application. - So far so good.
Now, within my PhoneGap app I need to check what that message actually says in order to open the correct view within my app via JavaScript.
I know there are quite some posts about this but I couldn't find some clear answers to these questions:
Does PhoneGap support push messages?
If yes, where is the documentation for that?
If not, which plugins/frameworks can be recommended? So far I found pushwoosh and Urbanair. Are they any good?
Regarding Pushwoosh, I noticed that I need some kind of pushwoosh ID - Why that?
By Pushwoosh ID you most probably mean Pushwoosh App Id or Application Code. It's an ID of your application in Pushwoosh Control Panel (current format is XXXXX-XXXXX). You will see it as soon as you add a new app in Pushwoosh.
There was quite an extensive blog post made by Holly Schinsky on easy PhoneGap integration with Pushwoosh
http://devgirl.org/2012/12/04/easy-phonegap-push-notifications-with-pushwoosh/
It should be very helpful for all PhoneGap developers aiming to integrate push notifications into their apps.
I found a really easy solution without using a framework.
I simply added the following code to the very end of the method didFinishLaunchingWithOptions (Right before the return statement):
if (launchOptions != nil)
{
NSDictionary* dictionary = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if (dictionary != nil)
{
NSLog(#"Launched from push notification: %#", dictionary);
[self addMessageFromRemoteNotification:dictionary updateUI:NO];
}
}
Also, I added this new method to my AppDelegate.m which gets the payload from the push message:
- (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary*)userInfo
{
NSLog(#"Received notification: %#", userInfo);
[self addMessageFromRemoteNotification:userInfo updateUI:YES];
}
(The NSLog calls above will show you what's inside the push message)
As a last step, I added this listener to do what ever I want with the payload:
- (void)addMessageFromRemoteNotification:(NSDictionary*)userInfo updateUI:(BOOL)updateUI
{
// do what ever you want with userInfo
}
If you want to do an additional JavaScript call with this info, I recommend using:
[self.viewController.webView stringByEvaluatingJavaScriptFromString:#"callSomeJSFunction()"];
Of course you can also pass arguments as strings into that JS function if you want.

Categories

Resources