NewsWatch is an example iOS application that uses Bluemix Push Notification service, Openwhisk, Cloudant and Watson Text to Speech service.
NewsWatch will will send give you latest news based on your preference. Once you subscribe for your interested topic , you will rceive a push notification every hour with the latest news. If you don't want to miss out the latest news you can enable the Play Push Notification option in the app to readout the news.
- iOS 10.+
- Xcode 8.+
Go to https://console.ng.bluemix.net and Log in. Click on Catalog on the top bar. On the left pane click on Boiler Plates below Apps.
-
Create a
Push notification service.
-
Click on Catalog on the top bar. On the left pane click on
WatsonbelowServices.Create aWatson Text to speechservice.
For getting push notifications APNs certificate is mandatory. Create a Development profile and Development provisioning profile in your Apple developer account after that follow the below steps,
-
Open the
Certificates, IDs & profilessection
-
Go to the
App IDssection and create a bundle identifier and enable push notifications
-
Go to the
Editsection and addDevelopment SSL CertificateunderPush notificationsection -
Download the certificate and double click on it, certificate will get added to the
Keyachain
-
Right click on the certificate and select export option. Save it as a
p12with valid password.
Point the terminal to NewsSeconds folder and do pod install and carthage update. This will add Cocoapod dependencies and carthage dependencies to the app.
Follow the below steps,
- Open the
NewsSeconds.xcworkspaceinXcode(make sure you are using Xcode 8+) - Go to General and
Uncheck the auto signing
- Add you bundle Identifier that you created here
- Go to the
Build settings -> Signingsection. Add yourprovisioning profile,Code signing IdentityandDevelopment team.
- Open the
Capabilitiesand addPush notifications,backgound Modes
- Open the
bluemixCredentials.plistfile and add values for the following ,
- Build the project.
Go to OpenWhisk Web editor .
-
Create an openWhisk action named
GetLatestNewsAPIand add the code fromopenWhisk/GetLatestNewsAPI.swift
-
Create another openWhisk action with the code
openWhisk/SwiftAction.swiftadd values for the following . -
create a alarm based trigger for the above action (step 2)
Open your Bluemix push service and configure for iOS
Create the following tags in push service
{
{
"name": "reddit-r-all",
"description": "Reddit"
},
{
"name": "cnn",
"description": "CNN general news tag"
},
{
"name": "bloomberg",
"description": "Bloomberg business tags news"
},
{
"name": "business-insider-uk",
"description": "Business Insider business"
},
{
"name": "bbc-sport",
"description": "BBC Sport news tag"
},
{
"name": "financial-times",
"description": "Financial Times business"
},
{
"name": "t3n",
"description": "T3n technology"
},
{
"name": "google-news",
"description": "Google News general"
},
{
"name": "the-wall-street-journal",
"description": "The Wall Street Journal"
},
{
"name": "buzzfeed",
"description": "Buzzfeed entertainment"
},
{
"name": "abc-news-au",
"description": "ABC News (AU) news tag"
},
{
"name": "time",
"description": "Time general"
},
{
"name": "usa-today",
"description": "USA Today general"
}
}
Run the iOS application . Go to settings page and enable Push notifications, Play push notifications. Select your favorite news channel from the dropdown.
Thats it folks !!!..
Copyright 2016 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.











