This will detect if you are in Phonegap (vs. desktop browser)
784 views
Skip to first unread message
JJBigThoughts
unread,
Apr 22, 2009, 10:29:10 AM4/22/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to phonegap
Maybe this will help someone. Maybe there is a more elegant way of
doing this?
// Motivation: I made a web app with which I wanted to use the same
code on the web and in phonegap. I'm using this to turn on/off
corresponding behavior, like telling the web user about the phonegap
version
// @Authors: JJBigThoughts
function isPhonegap() {
if (window.Device !== undefined) {
return true;
} else {
return false;
}
}
David Orchard
unread,
Apr 27, 2009, 3:10:56 PM4/27/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to phonegap
Could you try some of the phonegap specific calls and if they don't
work then you know? All of the JS calls to gap: ought to fail right?
Dave
Joe Bowser
unread,
Apr 27, 2009, 3:30:11 PM4/27/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to phon...@googlegroups.com
I think that the window.Device testing is probably the best way to deal with this. Android doesn't have any calls to gap: and I don't think that Blackberry does either. That's to be taken into consideration if you're looking to port this app to all the supported platforms.