iOs push notifications don't work in production mode - php

I developed an app using push notifications. To send notifications I used PHP code. I followed the following tutorial: The tutorial
The tutorial works correctly with the development mode, but in production mode doesn't work. I repeated the tutorial using the aps_production certificate and reusing the same private key getting from the keychain.
When I execute the php I receive a successfully message but the device doesn't receive the notification. I was trying to solve the problem and I couldn't do it. I know that the device token is different and I'm using the correct token because the app sends it to a server that stores it.

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

Testing in-app/banner notifications

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...

Google Cloud Messaging test application

I'm a PHP developer and I have this assignment where I have to send GCM messages to an android application.
I have zero experience on developing android applications so I would like to know if there's a sandbox or a test application where I can test if my server is working properly.
I'm creating the server with these instructions:
GCM with PHP (Google Cloud Messaging)
It seems that I need a server api key (which I know how to create in the google developer console) but how can I create a blank application? I need exact tutorial since I know nothing about it.
I found this answer earlier: https://stackoverflow.com/a/12437549/1278155 but I have no idea what to do with the .zip file provided.
1
You need to register the App on Google Console. For this you need following information about the application to which you wish to send notifications:
SHA Certificate : This is a key that uniquely identifies the Machine on which the app is being created and the app itself. There is a Command Prompt command to get this key directly.
Package name : Each application has a unique Package Name as you have a URL for PHP projects.
The app developer can provide with these details. Then on successful app registration you will get ProjectCode and a Key. These will be needed in further process
2
Next to go a bit deeper and explain why all this information is required by GCM, you see on device side, the app needs to register the user with GCM and in return it gets a GCM-ID at run time. Then This GCM-ID received is passed on to the server side(You). The developer will need ProjectID and Key that was generated in #1.
3
Now when you trigger your code to fire a GCM, you mention the GCM-IDs to send the notification to specific devices or else you can mention the ProjectID that you receive at the time of app registration with Google Console. These parameters are handed over to Google's Side of things.
4
Now if you pass ProjectID, Google can fetch all corresponding GCM-IDs to this project-ID or else you have specifically passed some GCM-IDs. Then the Google will push a message to all devices corresponding to the GCM-IDs.
5
Still not over, The message reached the target device, but not the target Application on the device. So for this purpose we need the package name at the time of registeration o Google console.

not being able to establish device-to-device messaging using GCM

I am trying to establish device to device messaging using Google Cloud Messaging. I tried using socket programmng, but the connection used to get lost everytime I moved to the next page. Thus I am using GCM. The plan is to send a message from client's phone and it should be displayed on server's phone, using 3g/wifi and not bluetooth.
I am referring the following link for the same:
http://androidexample.com/Device_To_Device_Messaging_Using_Google_Cloud_Messaging_GCM_-_Android_Example/index.php?view=article_discription&aid=122&aaid=142
It has no errors and is running, but nothing is displaying on the screen. Also a few doubts:
In the code in CommonUtilities.java what should be the Server_Url? I am using XAMPP, so should it be XAMPP's URL?
Also, what should be the Sender_ID?
Also in MainActivity.java, what should be the device IMEI? Do we have to enter that manually, or will the device fetch on ots own.
Also in the php files, its written enter "GCM Registeration ID got from device".Is it client's ID? I am running using Google API and registering my ID in the settings of the emulator before proceeding further.
Can anyone please tell me where am I going wrong? Or even if you have a better idea, please do share here. I am looking for mobile to mobile communication only, not using push notifications.
GCM is working as follow:
1/First of all you have to register your application in google and get your Sender_ID
2/the client connect to GCM cloud in order to register it self (using the SENDR_ID)
3/GCM cloud send a registrationID to the client
4/You should make a server so that you save the registrationID of any device that runs your apps
If you want to send a GCM notification from one client to server
1/the client should connect to your server
2/tell the server to make a demande to the GCM cloud containing the registrationID of the server so that the GCM send the notification to the server
you will find a detailed explanation here

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.

Categories