openwhish app readme

来源:互联网 发布:东方永夜抄 mac 编辑:程序博客网 时间:2024/05/19 22:56

OpenWhisk Logo

OpenWhisk

Bluemix Mobile Starter for OpenWhisk in Android Java


Table of Contents

  • Summary
  • Requirements
  • Configuration
  • Run
  • License

Summary

The Bluemix Mobile Starter for OpenWhisk will showcase how you can invoke OpenWhisk actions from a Mobile App.
It contains a sample OpenWhisk action actions/pushAction.js that will trigger a push notification from OpenWhisk and notifiy the Mobile App that invoked it.

Requirements

  • Android Studio
  • OpenWhisk namespace
  • OpenWhisk Auth Header

Configuration

  • Bluemix OpenWhisk

Setup the OpenWhisk.

For OpenWhisk setup, you need to get authentication from Bluemix OpenWhisk. Install OpenWhisk CLI and Auth.

After following the instructions to configure your openwhisk CLI, navigate to app\src\main\res\values\open_whisk_credentials.xml and use the same values to set the namespace and auth header.

Create Whisk Action

If you plan on enabling push notifications in your Android app, you must follow the Firebase configuration settings. Mainly adding the 2 package names to your Firebase console and updating the google-play-services.json in your Android app. Start at “Complete the following steps using the Firebase Cloud Messaging (FCM) console.”

Once complete, use the following WSK CLI command to create your push action in OpenWhisk. Don’t worry about editing the js file, your push instance app secret has been populated automatically.

wsk action update pushAction actions/pushAction.js

To see the fully qualified name, run in the CLI:

wsk action get --summary pushAction

Qualified names are formatted by /namespace/package/action(or trigger)name.

An example of a qualified name is tcheng@us.ibm.com_dev, which means:

namespace = tcheng@us.ibm.com_devauthHeader = long string after -auth, formatted like openwhisk appid:auth password

Please set the namespace and auth header accordingly in the app\src\main\res\values\open_whisk_credentials.xml (as mentioned above).

Run

After importing into Android Studio, build and run the generated mobile application. You will be greeted with a list of your personal namespace’s OpenWhisk actions. Select an action and see the response displayed in real time.

License

This package contains code licensed under the Apache License, Version 2.0 (the “License”). You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 and may also view the License in the LICENSE file within this package.

原创粉丝点击