4

I'm trying to implement Twilio swift quick start app, anyway I want to configure the app on both platforms iOS and Android,

I reached step 8 in the iOS tutorial

enter image description here

and I have a new PUSH_CREDENTIAL_SID for the iOS from the APN type, while the Android app is from the FCM type already have a PUSH_CREDENTIAL_SID that is being used in the config server file.

enter image description here

$ACCOUNT_SID = 'XXXXXXXXXXXXXXXXXXXXXXXXX';
$API_KEY = 'XXXXXXXXXXXXXXXXXXXXXXXXX';
$API_KEY_SECRET = 'XXXXXXXXXXXXXXXXXXXXXXXXX';
$PUSH_CREDENTIAL_SID = 'XXXXXXXXXXXXXXXXXXXXXXXXX';
$APP_SID = 'XXXXXXXXXXXXXXXXXXXXXXXXX';

How can I Add multiple PUSH_CREDENTIAL_SIDs for both apps ? or is there another way to figure this out ?

Thanks in advance

MhmdRizk
  • 1,266
  • 11
  • 27
  • Are you asking about the server-side code? Couldn't you just create variables like $FCM_PUSH_CREDENTIAL_SID and $APN_PUSH_CREDENTIAL_SID ? – Mike Taverne Jun 22 '20 at 15:37

2 Answers2

1

In your code you can have only 1 push_credential_sid.

In order to use the android AND ios at the same time, you should go into your project using this link: https://www.twilio.com/console/notify/services

Create a new service, and you will be able to create a service with the serviceID for android and IOS.

It will provide you a new serviceID to (SID) to use in your backend code.

And it should work for both platform :)

source : https://www.twilio.com/docs/notify/configure-ios-push-notifications#configure-your-twilio-service-to-use-your-apns-credentials

GuillaumeAgis
  • 3,535
  • 1
  • 18
  • 24
0

From the backend server, it only can config one push service id in 'PUSH_CREDENTIAL_SID', but if you check the backend code logic, then we can find it just use these information and create a JWT for the APP. So for the accessToken API, APP can pass one more parameter push_sid (the current parameter is identity), backend server will parse this push_sid from the APP request, but do not read from env config any more. Android will pass the FCM push service id and iOS will pass the APN service id, so one server can support both Android and iOS.

Cary
  • 1