0
votes

I have noticed when i deployed App in Android device using titanium Alloy, Its working slowly and it seem like android App need time to redirect to next page after touch and click.it goes to next page within 3 or 4 seconds after i clicked on any UI elements(Button,view,label,image)

On other side, its working perfectly with IOS devices (iphone and ipad)

I don't know what should exactly a problem with android.I also reset my factory data in android and tested app again but still issues arrives

Is this android touch/click issue?

Please feedback on my issues and give me your suggestion how to fix it. Thanks in advance

3
Can you post one controller that have this issue? - Giordano

3 Answers

1
votes

Your problem is not the device, but probably is your login's API. I suggest you insert an indicator to bridge the waiting time like this:

----index.xml----
<Alloy>
    <Window class="login_container" height="auto" horizontalWrap="true">
    <ActivityIndicator id="activityIndicator" message="Wait please..."/>

----index.js----

function login(e) {  
var uname = $.username.value.split(' ').join('');
var pwd = $.password.value.split(' ').join('');

if(uname == ""){
    alert("Enter username.");
    return false;
}
if(pwd == ""){
    alert("Enter password.");
    return false;
}

$.activityIndicator.show();

And before change controller add

$.activityIndicator.hide();
0
votes

Below is my controller,view files for one page in titanium

----index.js---

function login(e) {  
    var uname = $.username.value.split(' ').join('');
    var pwd = $.password.value.split(' ').join('');

    if(uname == ""){
        alert("Enter username.");
        return false;
    }
    if(pwd == ""){
        alert("Enter password.");
        return false;
    }




    //if(results.length == 0){
    if (Titanium.Network.networkType === Titanium.Network.NETWORK_NONE) {
           alert('There is no internet connection.');
           return false;
        } 

        var loginReq = Titanium.Network.createHTTPClient();
        var params = {
            func : "'"+Ti.Utils.base64encode('check_login')+"'",
            username : uname,
            password : pwd
        };
        loginReq.onload = function()
        {
            var json = this.responseText;
            var response = JSON.parse(json);
            if(response == 'account_inactive'){
                alert('Your account has been inactive. Please contact to your company');
                //$.index.close();
                var index = Alloy.createController('index').getView();
                index.open();
                return false;   

            }


           if(response == 'invalid'){
                alert('Invalid username or password');
                //$.index.close();
                var index = Alloy.createController('index').getView();
                index.open();
                return false;       
            }

            else
            {
                results = {
                    iuser_id: response.iuser_id,
                    signup_ids: response.signup_ids,
                    staff_id : response.staff_id,           
                    vusername: response.vusername,
                    vfirst_name: response.vfirst_name,
                    vlast_name: response.vlast_name,
                    vemail : response.vemail,
                    vpwd : response.vpwd
                    };  
                Ti.App.Properties.setObject("user_session",results);
                results = null;
                var flag = '';

                if (!Ti.App.Properties.hasProperty('installed')) 
                {
                    Ti.App.Properties.setBool('app:isLoggedIn', true);
                    Ti.App.Properties.hasProperty('installed');
                    Ti.App.Properties.setBool('installed', true);
                    var th_sign = Alloy.createController('login').getView();
                    th_sign.open();
                }
                else
                {

                    var th_sign = Alloy.createController('account').getView();
                    th_sign.open();
                }
                }       

            json = null;
            response = null;
        };
        if(os_name == 'android'){
        loginReq.open("GET", WEB_ROOT+"get_init.php");
        }
        else{
        loginReq.open("POST", WEB_ROOT+"get_init.php"); 
        }
        loginReq.send(params);

}
$.index.open();

----index.xml-------

<Alloy>
    <Window class="login_container" height="auto" horizontalWrap="true">
        <ScrollView id="scrollView_index" showVerticalScrollIndicator="true" height="100%" width="100%" scrollType="vertical">
            <View id="index_view">

                <ImageView class="logo" image="/images/login/logo.png" top='25' />

                <TextField id="username" class="usernameTxt" value="" border="0" top="230" />
                <TextField id="password" class="passwordTxt" value="" border="0" top="275" />
                <Button id="loginButton" class="login_bg" onClick="login">Login</Button>


            </View>     

        </ScrollView>       
    </Window>
</Alloy>
0
votes

I get understood what You said and explained by use of Activity indicator to wait for some time But that will solve problem only for Login Activity. But wherever I used UI utilities like, (Button Onclick, Label onclick, Image Onclick, View Onclick) It takes at least 4 to 5 seconds time to redirect to next page. I also used Loader between switching of two pages But still it takes time(4 to 5 seconds) to effect click event and redirect to next page