0

I am building a mobile app with PhoneGap and it will download a file from my server, where I have php. I am looking for a way to differentiate between my phonegap app and "every other browser" from the php. I know how to look for user agent string in php, my question is if there's a string (like "PhoneGap") that I'll have in the user agent on every platform (android, iphone, etc) or if there's a way to tell PhoneGap to use my custom user agent string.

Optionally if there's an idea what could I do in order to serve these files when the PhoneGap FileTransfer asks for them, but not when another browser does, is welcome. I don't want to force the users to create an account if there's another way.

Gavriel
  • 18,880
  • 12
  • 68
  • 105

1 Answers1

1

The best way is to pass additional parameter together with the upload call. You can determine if the page loaded from PhoneGap or not using JavaScript, to do that read my post about it here.

Another way, but it's not perfect is to search in the UserAgent if it's iPhone/iPad/iPod/Android/BlackBerry/...

Community
  • 1
  • 1
Slavik Meltser
  • 9,712
  • 3
  • 47
  • 48