function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Geetha ReddyGeetha Reddy 

Mobile Apps...

Hi to all,

 

I am new to Mobile apps.

Can any one post the tutorials , pdf etc regarding Mobile apps.

 

 

Thanks in Advance... 

Geetha ReddyGeetha Reddy

Thank q,

 

But I have small doubts like how can we differ Mobile page and Web Page .

For example,

 

I am creating Sites, So that we are getting URL.

 

That url we can use from PC or from Mobile. How can i show difference between them.

KapilCKapilC

Hi Geetha,

 

I have tried for the same and an attribute ''User-Agent' worked for me. I have tried this for a pc and a i-pad. Here is code for page and class. Hope it'll helps you.

 

Page:-

<apex:page docType="html-5.0" sidebar="false" showHeader="false" cache="false"
	             standardStylesheets="false" controller="ServerSideDeviceDetection"
	             action="{!detectDevice}">
	  <h1> This is the Desktop Version</h1>
</apex:page>

 Class:-

public with sharing class ServerSideDeviceDetection {
	    public boolean isIPhone {get;set;}
 
	    public ServerSideDeviceDetection() {
	         String userAgent = 
	                System.currentPageReference().getHeaders().get('User-Agent');
	         isIPhone = userAgent.contains('iPad');
	    }
	 
	    public PageReference detectDevice(){
	        if (isIPhone)
	            return Page.PhoneVersion.setRedirect(true);
	        else
            return null;    
	    }
	}

 

[If you got answer from my post please mark it as solution.]

 

Thanks,

Kapil