Detect Mobile Environment

Use this board to ask questions or have discussions with other Rich Displays users.
emhill
Experienced User
Posts: 116
Joined: Wed Sep 05, 2012 11:14 am
First Name: Eric
Last Name: Hill
Company Name: Integrated Corporate Solutions
Phone: 256-760-8239
Address 1: 501 S Wood Avenue
City: Florence
State / Province: Alabama
Zip / Postal Code: 35630
Country: United States
Contact:

Detect Mobile Environment

Post by emhill »

We are going to attempt to dive into the mobile side of things in Profound UI and I had a few questions. We are wanting to put our item inquiry on the iPhone. We want our techs to be able to quickly look up an item to see if it is in stock and what branch has it. We do not want to have to write a completely new item inquiry program for this if at all possible. We want to use the existing item inquiry. We also do not want to actually create an app but to just allow the user to access the program via the iPhone web access.

1. Is there a way to detect what environment the user is in at the time the program is called? I know you can call a PUI program to determine if you are in a Genie session or not but is there something similar to detect a mobile device?

2. By just coming in via the iPhone's web access will the smart phone functions still work? Finger controlled dropdowns, finger controlled scrolling of grids/subfiles, etc.

Looking forward to doing this but need a little up front assistance.

Thanks in advance!!!!!
User avatar
David
Profound Logic Staff Member
Posts: 690
Joined: Fri Jan 04, 2008 12:11 pm
First Name: David
Last Name: Russo
Company Name: Profound Logic Software
Contact:

Re: Detect Mobile Environment

Post by David »

There is a global JavaScript flag "pui.touchDevice" which will be set to true if running on an iPhone.

This is not automatically communicated to RPG, though. One approach that may work is that your RPG program could look at the "user agent" string that is sent from the iPhone's browser.

The "user agent" string is a text value that a browser passes to the server to identify itself. See here for Apple's explanation for iPhone:

https://developer.apple.com/library/saf ... Phone.html


You can get the user agent string in a Profound UI application like this:
RPG CODE
D getenv          PR              *   ExtProc('getenv')                                                                        
D  name                           *   Value Options(*String)                                                                   
                                                                                                                                    
     D UserAgent       S            200A                                                                                            
                                                                                                                                    
      /FREE                                                                                                                         
                                                                                                                                    
        If getenv('HTTP_USER_AGENT') <> *Null;                                                                                      
                                                                                                                                    
          UserAgent = %Str(getenv('HTTP_USER_AGENT'));                                                                              
                                                                                                                                    
        EndIf;                                                                                                                      
                                                                                                                                    
      /END-FREE
If running in a Genie session, there is not a way to get the user agent string, unfortunatley -- the above code will only work when running outside of Genie.
User avatar
David
Profound Logic Staff Member
Posts: 690
Joined: Fri Jan 04, 2008 12:11 pm
First Name: David
Last Name: Russo
Company Name: Profound Logic Software
Contact:

Re: Detect Mobile Environment

Post by David »

To answer your other questions here, yes, the touch gestures you mention there will work fine, and also the pop-up keyboard, etc.

The only things that you get by running natively on the phone vs. in Safari, is that in Safari you will not have access to the hardware features -- like the camera, etc.
emhill
Experienced User
Posts: 116
Joined: Wed Sep 05, 2012 11:14 am
First Name: Eric
Last Name: Hill
Company Name: Integrated Corporate Solutions
Phone: 256-760-8239
Address 1: 501 S Wood Avenue
City: Florence
State / Province: Alabama
Zip / Postal Code: 35630
Country: United States
Contact:

Re: Detect Mobile Environment

Post by emhill »

Thanks for reply, David!

I was able to get to the program via the iPhone with no problem but the sizing is all wrong. It is too big for the iPhone screen. When I created the display file and formats in Designer I used the mobile layout with the iPhone canvas (320X480) but it is not scaling right to my screen. Is there something else I need to do when creating the display file? The program is working fine. The dropdowns are working just as you said they would but the screen size is not right. I attached a couple of screenshots from my phone. The first is scrolled all the way to the left and the second is scrolled to the right.
image1.png
image1.png (11.41 KiB) Viewed 4191 times
image2.png
image2.png (15.73 KiB) Viewed 4191 times

Thanks is advance for any help on this!!!!!!
User avatar
David
Profound Logic Staff Member
Posts: 690
Joined: Fri Jan 04, 2008 12:11 pm
First Name: David
Last Name: Russo
Company Name: Profound Logic Software
Contact:

Re: Detect Mobile Environment

Post by David »

Hard to say from the shots. Do you mind attaching your display so that we could have a look?

An easy way to do that is to use Save As, then click on the "Local" tab. This will download it to a PC file that you can attach here.
emhill
Experienced User
Posts: 116
Joined: Wed Sep 05, 2012 11:14 am
First Name: Eric
Last Name: Hill
Company Name: Integrated Corporate Solutions
Phone: 256-760-8239
Address 1: 501 S Wood Avenue
City: Florence
State / Province: Alabama
Zip / Postal Code: 35630
Country: United States
Contact:

Re: Detect Mobile Environment

Post by emhill »

Attached is the file in .txt format... There is one that is a replica of the JSON type and another that is a copy of the saved DDS.
Attachments
ic0357fm.txt
(62.68 KiB) Downloaded 794 times
IC0357FM.txt
(28.3 KiB) Downloaded 626 times
Antonio
Profound User
Posts: 82
Joined: Fri Jun 29, 2012 2:33 pm
First Name: Antonio
Last Name: Ruballos
Company Name: Profound Logic
Contact:

Re: Detect Mobile Environment

Post by Antonio »

Hello,

We were able to fix this on our end by adding the following:

maximum-scale=1.0

to the following line inside of the start.html file located in profoundui/userdata/html:

<meta name="viewport" content="width=device-width, initial-scale=1.0, target-densitydpi=device-dpi" />

So, something like:

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, target-densitydpi=device-dpi" />

Also, I noticed you werent using percentages for the position of your objects. Using percentages allows your objects to be more dynamic in size and position and allows them to change whenever a device rotates (as opposed to being static). YOu can manually define these percentages for the position properties of each object,or you can use the predefined percentages located in design tab.

Let me know if you have any more questions!
emhill
Experienced User
Posts: 116
Joined: Wed Sep 05, 2012 11:14 am
First Name: Eric
Last Name: Hill
Company Name: Integrated Corporate Solutions
Phone: 256-760-8239
Address 1: 501 S Wood Avenue
City: Florence
State / Province: Alabama
Zip / Postal Code: 35630
Country: United States
Contact:

Re: Detect Mobile Environment

Post by emhill »

I changed my SCR01 format to SCR01A and used percentages. I made the change to the start.html code as well. Still doing the same thing. No difference at all. After changing the start.html code would I have needed to reboot or restart something?

Thanks for your help!
Antonio
Profound User
Posts: 82
Joined: Fri Jun 29, 2012 2:33 pm
First Name: Antonio
Last Name: Ruballos
Company Name: Profound Logic
Contact:

Re: Detect Mobile Environment

Post by Antonio »

You would have to reload the application after making changes to start.html, but I imagine you did that.

What version of Profound UI are you using? Also, could you send me a copy of this new display file? Ill see if I still get the original problem with your new screen on my end, and debug it from there.

Also, if you could send me a copy of your start.html or a screenshot of it, thatd be great.

Thanks!
emhill
Experienced User
Posts: 116
Joined: Wed Sep 05, 2012 11:14 am
First Name: Eric
Last Name: Hill
Company Name: Integrated Corporate Solutions
Phone: 256-760-8239
Address 1: 501 S Wood Avenue
City: Florence
State / Province: Alabama
Zip / Postal Code: 35630
Country: United States
Contact:

Re: Detect Mobile Environment

Post by emhill »

We are on version 4.1.7. Attached are the files you requested...

Thanks!
Attachments
START HTML.txt
(801 Bytes) Downloaded 582 times
IC0357FM DDS.txt
(78.03 KiB) Downloaded 604 times
IC0357FM.txt
(35.18 KiB) Downloaded 786 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest