I would like to create a simple AIR app that show's a notification on the bottom right of the users screen. this app won't show all of the time, it will just show if I push a new notification to the users computer. I am doing this in Dreamweaver. It will open on Windows XP computers only.
So far I have found out how to show a notification window with my html file:
notification.load( new air.URLRequest( HTML_SOURCE ) );
What I am not clear on is:
how to have this happen automatically on login.
how the AIR app can check if a new msg is available.
how best to exit the app
Thanks for any help!
For starting application on login, you have to set air.NativeApplication.nativeApplication.startAtLogin = true
For details u=you can have a look at this adobe article.
You can store messages with a increasing message_id column. So when your application shows any message it can store that value as last_message_read in your data. Then you can use this value to check if new messages are available (You will have to save this variable in a file)
For exiting application you can use air.NativeApplication.nativeApplication.exit();
or just close your main application window by close(). It will automatically close your application.
Related
I want to integrate skype for business with my web app, just want to open the app on button click.
There is a way to open a chat window with some specific user via below line in js:
document.getElementById('skypeChat').href="im:<sip:"+textEmail+">";
but i want to only open the app and land on the home screen of the app and not to initate any chat.
I managed to get it working by setting textEmail to the user's own email address.
For example, if your application knows that the user is using SfB address john.doe#domain.com, then this should (could?) open SfB on the starting page:
const textEmail = "john.doe#domain.com";
document.getElementById('skypeChat').href="im:<sip:" + textEmail + ">";
Presumably this happens because they can't chat with themselves, and no error is shown - or at least that is what happens for me; your mileage may vary.
According to documentation you have to use skype:, not im:.
Also to simply activate Skype, you should leave empty action.
document.getElementById('skypeChat').href="skype:";
I have multipage application and I need to check if user was alredy open an app in other browser tab or in other browser window (IE8) and avoid this (logout user in opened new window/tab)
I use JSP, JavaScript and jQuery
If its real - not to use sessionStorage
EDITED
I also use iframes and IE8 modal dialogs.
You'd need to use a technology like SignalR that keeps a connection open. Then you'd need to ping the connections to see if that user is connected and close out their existing connection. If that implementation is too daunting, you can add a timer loop to your app/page that calls the logins table (or whatever storage device for these events) and if there are new logins, calls its own logout procedure.
One approach would be to maintain a map (in memory or in db based on user count) in your application scope which stores username vs session-id. On every login, you lookup in this map if already a session exist for that username. If exist, invalidate existing session, else store the new session-id in map. [not tested]
you can pass the the user session id or random generated id to global/window variable, ie;
window.state = 'SomeLoginIdString';
keep the state in some other variable where you client pages can easily access, preferably a datastore on client.
var loginAccessCurrentState = 'SomeLoginIdString';
When use open/switch pages compare both, if it false you can redirect to a 404 page.
loginAccessCurrentState === window.state
The idea is you only pass the state during login session, if user open a new tab, the state is undefined by default.
For single page applications the following way could be an easy solution:
Create a random ID on the entry page, store it in the session and in the GUI
On each Ajax call add the random ID to the request as additional HTTP header
if the ID does not match between given header and session, the application was opened in another tab/window and this call is coming from the "old" tab
the resulting answer of the server must then lead the GUI to lock / close itself in the affected tab
So I am creating a simple app to upload a file to Firebase Storage and then save the download URL to the Firebase Database.
The steps of the app:
user press a button
camera opened
user capture image and confirm the image they just capture.
app upload the image to the Firebase Storage
app get the download URL of uploaded image
app send/save the URL to Firebase Database
Steps 1 to 5 run without a problem. However, at step 6, the data is not stored to in the database, not until I change the view of the app. I am using Ionic by the way. And this is the code I use for Step 6.
var ref=FirebaseRef.child('kejadian/');
var list = $firebaseArray(ref);
list.$add({
'lokasi':lat+','+long,
'pelapor':userid,
'gambar':gambar,
'waktukejadian':timestamp
}).then(function(ref) {
alert("Terkirim");
console.log("inisiasi data selesai");
});
Same thing happens when I try to retrieve data from the database,
the data is retrieved (and displayed to view) only after I do something in the view (like click on the input field or something).
This is probably occurring in Ionic framework. The logic is working fine with native Android.
Is there anything wrong with my code or the way I implemented the code?
I am new to Firebase and Angular. Any suggestion would be very appreciated.
I've been trying to make tutorial page for my app first installment using ionic framework. Is that even possible to make the tutorial page ? Because I can manage to make the splash screen and icon already. An Example maybe ?
You can achieve that by storing something into localstorage, where on your index.html's controller, you will check for the localstorage if the user has seen the intro or not. And once the Intro page is loaded, the localstorage variable would be stored as seen by user or something.
I used Ionic's Slidebox example, I simply added these to the 2 controllers to check if Intro was seen.
YourMainController:
if (window.localStorage.getItem("didIntro") === null) {
$state.go('intro');
}
YourIntroController:
window.localStorage.setItem("didIntro", "seen");
You can checkout this Codepen that I modified for this.
PS: The intro would be shown to the user if they un-install the app or Clear Data of the app. If that bothers you, you could keep server side identification of a user and upon authentication, you could check the didIntro flag you save on your server.
Update: Working as designed once I cleared my cookies. Doh!
I'm working on an app that for various reasons uses the Facebook
Javascript API to initiate a Facebook connect session. I'd like to be
able to use that session in a few rails methods using Facebooker.
The basic workflow is like this:
User goes to non-rails page and logs in to FB Connect via JS
User goes to another non-rails page and can view FB data such as
name, profile pic
User goes to a rails based page - rails uses session created in
step 1 to do some processing
My problem is in step 3. Facebooker detects the session fine, but when
I try to call a method like facebook_session.user.name I get: Session
key invalid or no longer valid
If I go back to the url in step two, my session still works fine.
So is this a fundamental incompatibility, or is there some data I can
send to facebooker so that I can hook into the correct session? Maybe
my facebooker.yml needs tweaking?
Any thoughts are appreciated.
My facebooker.yml
development:
api_key: redacted
secret_key: redacted
canvas_page_name: blah_blah
callback_url: http://test.domain:3000
pretty_errors: true
set_asset_host_to_callback_url: true
tunnel:
public_host_username:
public_host:
public_port: 4007
local_port: 3000
server_alive_interval: 0
Gah! Always clear your cookies before posting on the interweb people.
The problem was with an existing facebooker-based session that was still around in my browser.
All working now.