Testing in-app/banner notifications - php

I have recently joined a startup who has been using an offshore team up until now. Our app in built in Obj-C with a PHP backend, both of which I am fairly new to (I come from a JS background). I have been wanting to make some alterations to the current in-app notifications (banners), but have been unable to figure out how to test them. I am aware that testing notifications on the simulator is not possible, and have installed the developer build to my device. However, I am still not receiving any notifications when I would normally receive them in the production build, such as when a friend posts a message. If anyone has any experience with this I would love to hear it. I am currently developing in Xcode 8.2.1

This might get closed as too broad a question, but for what it's worth here are some checkpoints:
The app is enabled for notifications in iPhone Settings
The app is requesting a push token from APNS
(registerForRemoteNotificationTypes)
It receives a valid token from APNS and
passes it to your PHP server (didRegisterForRemoteNotificationsWithDeviceToken)
Your server is storing the token correctly
Your server is triggering a push notification correctly
Your development certificate is correct
(read this post iPhone APNS Device Tokens in sandbox vs. production)
If you want to test push without the server in the loop, checkout PushMeBaby (there are several on GitHub).

try it:
if app is already launched in App Store: they enabled the production certificated ... and u r running the application through Xcode ,u will not get the notifications in ur device... for that u need to create IPA file for ur project and run through iTunes...

Related

iOS FCM push notifications not received in TestFlight

I have an issue with FCM and TestFlight. I have an app which is written via Objective C. It uses push notification service via Firebase. I use APNs key instead of certificates.
The issue is when I run my app in debug and in release mode via Xcode I get push notifications. When I sign app with distribution profile and send it to TestFlight and install it via TestFlight on same device push notifications not received.
We are using php server for the app. And push notifications are sent from that server via firebase. I have all the settings in AppDelegate file as it is stated in Firebase SDK docs. So all proper delegates are set and firapp configure called and so on like here. https://firebase.google.com/docs/cloud-messaging/ios/first-message Also I've checked entitlements file that APS-environment is set to Production when sending to TestFlight.
I've tried to set type of device token in didRegisterForRemoteNotificationsWithDeviceToken via [[FIRMessaging messaging] setAPNSToken: type:] to sandbox or prod whether it is debug or release mode of schema. Also I've using this code instead of that now [FIRMessaging messaging].APNSToken = deviceToken. But neither of the options work in TestFlight.
Our back-end dev says that on server push notifications are sent properly. So I suppose that it may be something related to device token.
Also I've update Firebase pods recently form version 3 to version 6. May be firebase lib on server should be updated as well?
Do you know what the issue can be? Any help is appreciated.
Update. I've found that this issue has began after updating firebase ios lib not from 3 to 6 version but from version 6.18 to 6.31.1. So my issue was bug stated in issue #6553 on official GitHub of Firebase iOS SDK. This bug was fixed in version 7.0.0. And after updating my issue was solved.
https://github.com/firebase/firebase-ios-sdk/issues/6553

Do I need to make 2 different applications for using GCM in android?

I tried searching these issues. Some sites say I need to do some stuff with php in order to make 3rd party server while others don't mention anything. some says it need JSON. Guide me please. PS I am a beginner and know java, XML,SQL only.
You should only need one server. The second server you are reading about may be the Google GCM cloud server? When I did a GCM project a few years ago, I had one server, it happened to be a App Engine instance. It generated events and sent them to Google via the GCM api and then onto onto the device. I don't remember it being that difficult.
I did have more than one server in the mix though, there were others that sent messages to the AppEngine server, but it was not required to send a GCM message.
Google Cloud Messaging (GCM) is a service that enables developers to send data from servers to both Android applications or Chrome apps and extensions.
So if you want to send data to the users of your App then you must have an interface or dashboard from where you can send some data (typically push notification) to the users of your app.
This dashboard (server from which you can send data) can be developed by using PHP or any script languages.
Now a though can come up in your mind:
"I am suppose to develop both the mobile app and the server then what
role does GCM play?"
Yes, GCM is playing a vital role indeed. The server we have to develop is just to design an interface so that you can type your message/notification and select the recipients. Rest of the part of (managing the queue, communication with the apps checking for authentication and all other stuffs will be done by mighty GCM )
In order to have an bird-eye overview you can take a look on this image collected form android hive
Server side coding is doesn't need you to be expert in php. So you can go through to this article. It helped me a lot to learn.

Push notifications not coming in Enterprise app

I have developed a simple app for iPad which has push notifications in it as a feature.
I created its app id and enabled the push notifications and downloaded the certificates for development as well as distribution.
I created .pem files for both as well.
While using development profile, everything worked fine and push notifications were working perfect.
But when I started checking it with distribution profile push notifications didn't come.
I also got the php file changed and removed sandbox from it. I checked everything but I cannot seem to find what is missing.
Do we need to do anything exclusive for Enterprise apps for enabling push notifications in them?
Thanks in advance.
Best regards

Push Notification using GCM - PHP

I am trying to implement Push Notification using GCM,
Besically i am trying to send Notification to the GCM using my PHP server which will deliver it to my android application.
I have used code at androidhive!
The device is getting registered successfully but i am not receiving any notification at my device nor anything is visible at Google console.
I am not receiving any response from the link used https://android.googleapis.com/gcm/send or https://android.googleapis.com
Is there anything wrong in this approach?
Can anyone suggest me any authentic source for this?
Realizing that some people are facing issues implementing GCM. I have decided to post solution.
The example on AndroidHive is working perfectly. Its just the matter of correct configuration.
Replace project ID in Android app. (You can get project ID from you google's console link i.e google.com/apis/console/#project:xxxxxxxxxxxx:access)
Replace Server API Key on PHP Server(config.php)
Key for server apps (with IP locking).
You can get your IP from WhatIsMyIP.
Key for browser apps (with referers) will not work.

Making Android chat application from scratch

I need to make chat application for android. I thought of using PHP script to implement the chat application. Basic idea is to send message form android client to PHP script and making use of PHP script send the messages to the MySQL database. These messages will be broadcasting to other people. But the problem is auto broadcasting messages to other people. Is there a way to do this using android and php?
You can do the following
Make a persistent tcp connection between your device and the PHP server
When a message is broadcast send it over the tcp connection of each device
On the device process this notification and you are good to go.
If you want to use Java on the server side I have your project already finished and ready to ship ;) (just kidding)
But if you are interested check out the Device-To-Device messaging framework of OpenMobster Mobile Cloud platform. The project is free and open source. Here is a link to the Device-To-Device Framework: http://code.google.com/p/openmobster/wiki/D2DPushFramework
and http://code.google.com/p/openmobster/wiki/PushFramework
The above three steps are already taken care of by the framework. The developer just has to focus on the App itself
Good Luck!!!!
Yes there is several ways to do this
you can just post to the server and from the server send push notifications to the mobiles
You can make the mobile keep checking for updates if it exists
You will require to finish these steps ( at least ):
setup a PHP web server
register for Android Push Notification (you probably need that)
create database schema
write your own codes to allow users to submit & retrieve chat messages
security !!!
You'd probably want to use Google's C2DM, though it's not free.
Your php server would get a message from a phone, do it's processing, then make a HTTPS request to Google's C2DM service, which sends the messages to the destination android device.
http://code.google.com/android/c2dm/#push-process
Don't use C2DM, its a deprecated. Please go through the GCM(Global Cloud Messaging),
please follow this link,
http://developer.android.com/google/gcm
Have you heard of Firebase? Firebase. Making a chat app with Firebase is like eating pizza.

Categories