Push Notification Sencha Touch 2 - extjs

Am Developing an IOS application using sencha touch 2, i have a requirement of sending push notification . I have set apple certificate file, provisional profile also did some server side coding to achieve this. But not sure about is there any push notification service in sencha ? How can i achieve this... Should i use PhoneGap?
Please direct me in right direction.. Your help is much appreciated. Thanks in advance

YES, to make your iOS Sencha-Touch based application support notification, you should use a third party plugin such as mentioned in the documentation :
-Sencha Packager
-PhoneGap
-Simulator
i used the PhoneGap implementation and in the app.js file i put the notifications related infos. when a notification is generated in the backend i send it to the right user based on the session's token stored on the moment of authentification:
Ext.Application({
...
//notifications Configuration
notifications : {
storeTokenUrl : 'https://adress/whereto/store/token/',
gcmsenderid : '0123456789012',
appid : 'apple_app_id',
title : 'notification title'
}
})

When i need to do Push Notification i was using sencha touch 2.0 (latest that time)
I used third party plugins like urbanairship, pushwoosh and it's good.
For these plugin you need to use PhoneGap.
Refer this links
cordova-push-notification
Building a Notification App for iOS with Sencha Touch and PhoneGap
Apple Push Notification Services in iOS 6 Tutorial

Thanks every one for guiding me in right direction. I used sencha native Device function to send push notification. It will not work in android. I achieved like the following way. I put this code in my app.js file . You will get the device token there. Sent the device token to your server . There you can configure push notification using this device token
Ext.device.Push.register({
type: Ext.device.Push.ALERT|Ext.device.Push.BADGE|Ext.device.Push.SOUND,
success: function(token) {
console.log('# Push notification registration successful:');
console.log('token: ' + token);
WinReo.app.devicetokenid = token;
WinReo.app.platform = Ext.device.Device.platform;
//Ext.Msg.alert('Title', WinReo.app.platform +'', Ext.emptyFn);
},
failure: function(error) {
console.log('# Push notification registration unsuccessful:');
console.log(' error: ' + error);
},
received: function(notifications) {
console.log('# Push notification received:');
console.log(' ' + JSON.stringify(notifications));
}
});
When u first open the app, i will ask whether this app allow push notification message. There you can select yes/no. Later you can edit this setting by go to settings/notification in device.

Related

Push notification in Web pages

Can a web notification be implemented in web sites? I'm using a environment of jsp's with jquery, vue and angular.js for the front side. There's a way to implement web notifications with this environment?
You can use the Notification API to achieve this.
If you want to use Service Workers to push notifications from a backend, you can check the Push API
These API are still drafts and may only work with modern browsers. Make sure you are using these API's over https.
you can use web socket, which has integrated in Angular already.
use for example:
https://github.com/mqttjs
then in your js:
this.client = mqtt.connect(url, options);
if(topics.length>0)
this.client.subscribe(topics);
this.client.on("message", (topic:any, payload:any)=>{
console.log('CONNECTED', payload);
});
this.client.on("connect", function (connack: any) {
console.log('CONNECTED', connack);
});
And use some server side message broker eg: rabbitMQ or other message router
read this
https://www.rabbitmq.com/web-mqtt.html
Yes, Web notification primarily targeted for Web application, client side registration and server sider processing for pushing the notification, below site has both client and server side examples -
ServiceWorker

Getting No response from google drive javascript api

I'm using google drive javascript api(v2) in my reactjs project.
And I'm using this function to get files from google drive.
this.getProjectObjects = function(query, callback)
{
var request = gapi.client.drive.files.list({
corpus : 'DEFAULT',
q : query,
fields : 'items(id,description,title,properties)'
});
request.then(function(resp) {
callback(resp.result.items)
}, function(err) {
console.log(err)
});
};
After authenticate the user, I can get the files using this function.
But, when I navigate to other react component, it's no longer working.
There is no response or error, api just hangs.
Silly thing is when I refresh page, it's working. Again if I navigate to other component, it's not working.
I'm using the same query, nothing changed during navigating.
Anyone have any ideas what the issue could be?
Thanks
You may want to check the Chrome devTools to see if you are encountering any problem when switching pages. Also in the documentation - Getting Started:
There are several ways to use the JavaScript client library to make API requests, but they all follow the same basic pattern:
The application loads the JavaScript client library.
The application initializes the library with API key, OAuth client ID, and API Discovery Document(s).
The application sends a request and processes the response.
The following sections show 3 common ways of using the JavaScript client library.
Option 1: Load the API discovery document, then assemble the request.
Option 2: Use gapi.client.request
Option 3: Use CORS
See the sample for code implementation on effectively loading and making API calls.
Hope this helps.

Which is the right method to handle oauth2.0 done in server using Ionic framework?

I am creating an Ionic app which has multiple 3rd party integration. I already have a java server which does the oauth2 authentication for the 3rd parties and redirect to the callback url in the server itself.
Now my task is to open back the app page after the server callback url is done.
I have tried the following method:
monitoring the url changes in app using ionic and redirect after the successful callback.
Which is the best way to handle this sitn.
Thanks.
Frankly, I haven't done anything like this. But to my mind, you can check ngcordova oauth implementation for ideas.
var browserRef = window.open(your_url);
browserRef.addEventListener("loadstart", function(event) {
//your code
});
browserRef.addEventListener('exit', function(event) {
deferred.reject("The sign in flow was canceled");
});
Check oauth.js source for more details.
Moreover, you can find the sample of using this implementation on this page.
http://mcgivery.com/using-custom-url-schemes-ionic-framework-app/
Above link may help you. If I am thinking correctly what you want?

Send SMS form AngularJS Web App

I want to send SMS from AngularJS web application. Can anyone tell me how to do this? Please suggest me some reference link or code sample.
One technique you could use is using Firebase and Zapier to help trigger sending your SMS. You can check out this blog post which details how to set something like this up.
The trick is loading data into your firebase when you want the SMS to be triggered like this:
var sendSMSText = function (recipient) {
var smsQueue = new Firebase('https://.firebaseio.com/sms/' + recipient.phone);
smsQueue.set({
name: recipient.name,
phone: recipient.phone
}, onSuccess)
};
Then setup Zapier to trigger a new action when an entry is added to your Firebase database. You can have this action trigger a Twilio SMS message.
Hope that helps.
Disclaimer: I work for Twilio.
not working in angular2

Issue with push notification using cron in Google App Engine

I am trying to perform push notification activitiy using a cron within Google App Engine. I have setup the cron successfully and it is showing no failures. Also in logs i see that Multicasts are being created for all devices which are registered. However i am not getting any push notifications. Same code if i change using a form for sending Push notifications, its working perfectly fine. Can someone guide me on what can be the issue?
Update
Below is the form i have created where i send a POST request via form. This form takes the Message from Text area and sends it to all devices.
out.print("<form name='form' method='POST' action='sendAll'>");
out.print("<fieldset>");
out.print("<textarea rows='10' cols='100' name='Message'>Enter HTML Message </textarea>");
out.print("</fieldset>");
out.print("<input type='submit' value='Send Message' />");
out.print("</form>");
When i replace them with a normal post request which reads out the message from Data folder using below code,
getServletContext().getRequestDispatcher("/sendAll").forward(req, resp);
i get success messages in GCM Logs but doesnt receive any push notification. Can someone guide on what can be the issue?
It was nothing specific to Google App Engine. Message which was created for push notifications had issue.

Resources