-
Create an Ionic app:
ionic start myApp https://github.com/backand/backand-ionic2-starter --v2
cd myApp
-
Install Cordova Plugins
ionic plugin add cordova-plugin-inappbrowser
-
Set details of your app in app/app.ts:
backandService.setAppName('your app name'); backandService.setSignUpToken('your signup token'); backandService.setAnonymousToken('your anonymousToken token');
-
Run the app
ionic serve
To fetch, create, and filter rows, from an object, say stuff
, modify
the url
used in these functions:
getItems
filterItems
postItem
replacing todo
with the name of your object, stuff
The app opens a dialog supplied by the social network.
Use the Facebook Connect plugin to obtain access to the native FB application on iOS and Android.
Install it with:
ionic plugin add cordova-plugin-facebook4 --save --variable APP_ID="<Facebook APP ID>" --variable APP_NAME="<Facebook APP NAME>"
Use BackandService
function inappSocial
-
Add to
package.json
the dependency,"socket.io-client": "^1.4.8"
Add to typings.json
the global dependencies:
"node": "registry:dt/node#6.0.0+20160514165920",
"socket.io-client": "registry:dt/socket.io-client#1.4.4+20160317120654"
- Install dependencies
npm install typings install
-
To login via socket call
BackandService.loginSocket
-
To logout from socket call
BackandService.logoutSocket
-
To subscribe to event
items_updated
from server side via sockets, callBackandService.on
and in your controller, subscribe with,this.backandService.on('items_updated') .subscribe( data => {
}, err => { console.log(err); }, () => console.log('received update from socket') );