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
Chidambar KulkarniChidambar Kulkarni 

Salesforce1 app crashes when back button is pressed

I have created a Salesforce1 app(android) which has only visualforce pages. The problems I have been facing is 

1. When I press back button from a vf page, the app closes  

2. When I try to upload an image, the page refreshes and all the entries are lost.

After going through some online resources. I have come up with the following code

   
<script src="/soap/ajax/29.0/connection.js"></script>
    <script type='text/javascript' src='/canvas/sdk/js/publisher.js'/>
    <script src="https://mobile1.t.salesforce.com/soap/ajax/30.0/connection.js" type="text/javascript" />
    <script>
    function myUpdate()
    {
    var accountId = document.getElementById('accountId').value;
    
    Visualforce.remoting.Manager.invokeAction(
    '{!$RemoteAction.StandardController.StandardController}', accountId, function(result, event)
    {
    if(result!=null) sforce.one.navigateToSObject(result,"detail"); 
    Sfdc.canvas.publisher.publish({name: "publisher.close", payload:{ refresh:"true"}});
    
    });
    }
    </script>

    <input id="photoFile" type="file" accept="image/*"/>
    <a href="#" data-role="button" onclick="myUpdate()">Save</a>



This is how my standard controller APEX Class looks like

   
public with sharing class StandardController {
        public ApexPages.StandardController standardController { get; set; }
        public StandardController(ApexPages.StandardController standardController) {
            this.standardController = standardController;
        }
    }