I am trying to use push notification on my app, I followed the tutorial.When I try the command php pushMe.php (this is my php file to send notification) on terminator, it works. My iphone got the message.But when I move my file to web server (2mhost.com) it does not work.
Can somebody tell me Why.
By the way,the socket and openssl are enabled on the server.
Related
I have recently begun building an Angular Ionic app which connects to PHP scripts on an AWS EC2 server. Everything works fine except for when I try to connect through Android once the app is built on my phone.
The response is a simple 404 response with no additional information. When I look at the log on Android Studio I see the following response:
E/Capacitor: Unable to open asset URL: [api address]
I have reduced both the HttpClient call on the frontend and the php file on the backend to their most simple forms and yet still nothing:
<?php
echo "Hello";
?>
I know that Capacitor was updated to 3 only a couple of months ago and am concerned that it is related to that. I am using PHP 7.
UPDATE
The issue was indeed cleartext but the issue was made more complicated by the fact that HttpClient was not catching the error and so I was simply getting back an unknown failed response.
In order to first see that it was cleartext I first had to change HttpClient for the Native HTTP plugin and check the logs whilst testing on my phone (HTTP will not work through the browser).
Only then did I notice that I hadn't changed the config file correctly.
As long as your PHP web server is not running on the Android device directly trying to connect to localhost / 127.0.0.1 won't work and you need to use another domain / IP your web server is available on and which the Android device can access. You can also check this by simply opening the URL in the browser of the Android device.
If that is not feasible for you you could also use port forwarding via adb to forward a port of your web server to a local port on the Android device.
If you use another domain / IP make sure your web server is not listening to local connections only and is not blocked by a firewall or similar.
Also if you are using an unencrypted connection (i.e. http instead of https) you might need to enable the cleartext config option in you Capacitor config.
I am creating a web portal using laravel framework to which one of its functionality is to send remote push notification on IOS App remotely. Many article in the internet is saying that we need the pem certificate file not p12. Why?
My co-worker who is developing the IOS mobile app, says that he is using the p12 certificate to get the push notifications from the Azure portal and successfully send push notification.
Is this because that he is pushing the app locally? Meaning the app directly sends the notification? And I am pushing notifications remotely from the web portal? Is there any difference when pushing the app remotely and locally?
Seems you are using Azure Notification Hubs. In Azure's official tutorial, they are obviously using the .p12 push certificate to configure authentication. So I think you don't need to worry to use it.
I am developing an android app implementing FCM. For testing purpose I need to implement my own script to send data.I am using linux and I am quite naive about server side implementation. I have a php script which is supposed to send data.It is on localhost.So what do I need to do to run the script. Do I need to bind my localhost to my IP .?? Also how do I know if my script has successfully send data.Right now I am not getting any error. I am using command line php -f var/www/html/filename. Thanks
We changed PHP version to 5.4.45 from 5.4.25 and installed MS SQL Driver on Server. Before server change, everything was working but after server change, I am facing web service issue. Our authentication Soap web service(written in Zend framework1) is not working only for IOS Devices. It is working for Android and from soap UI even we tried multiple times from Android and SOAP UI. It works every time.
if we uninstall the app in IOS device and reinstall then for the first time authentication web service works fine but if we call this service again then we are getting HTML data inside the response body which is not the actual response.
Same input request we are sending from ios and Android device.
Please suggest...
I figured it out. The issue was because of "debug mode". It was set to "true" in development environment. Now I set it to "false" and found web service is working for Android, IOS and from soap UI.
I have set up many push notifications in iOS projects. I always receive the same message which I have sent from my application, all going well.
But when I change my server from my local machine (or a dedicated server) to web hosting the message format changes somewhat. For which we are not accepting.
Sample message from our server:
{"msg":"match found !","match_id":"34","rqst":"1"}
Sample message from web hosting server (remote server) :
{\"msg\":\"Match found !\",\"match_id\":\"34\",\"rqst\":\"1\"}
It contains extra backslashes before and after every string.
FYI we are using Slim Framework with PHP MySQL APIs, and the messages sent are JSON.
Use PHP to get ride of the slashes before sending the message.
<?php stripslashes($YourMessage); ?>