Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

In app update functionality for android.

$
0
0

for Titanium 3.1.0 and Android 3.1-

How To Implement In-App Update Functionality in Your android App? Have you ever used an android app where upon opening it, it tells you that there’s a new update, after click on ok it will be updated with updated version of app. How to develop that functionality with titanium studio?

I have code for ipad app as:

var tools = require('bencoding.ios.tools');
Ti.API.info("module is => " + tools);
 
//Let's assume we are angry birds
var queryITunesID = '409807569';
Ti.API.info('We are querying for iTunes ID = ' + queryITunesID);
 
Ti.API.info("We will use our app version which is " + Ti.App.version);
 
var appStoreHelpers = tools.createAppStoreHelpers();
 
var win = Ti.UI.createWindow({
    backgroundColor:'white'
});
 
var checkButton = Ti.UI.createButton({
    title:'Query version Info',
    top:120, height:45, right:10, left:10
});
win.add(checkButton);
 
function queryResults(e){
 
    Ti.API.info(JSON.stringify(e));
 
    Ti.API.info("success = " + e.success);
    Ti.API.info("appStoreVersion = " + e.appStoreVersion);
    Ti.API.info("appID = " + e.appID);
    Ti.API.info("code = " + e.code);
    Ti.API.info("installedVersion = " + e.installedVersion);
 
    if((parseFloat(e.installedVersion) < parseFloat(e.appStoreVersion))){
        var alert = Ti.UI.createAlertDialog({
            title:'Update now', 
            message:'There is a new version available. Do you want to download now?',
            buttonNames : ['OK','Cancel']
        });
 
        alert.addEventListener('click', function(y){
            if(y.index == 0){
                appStoreHelpers.launch(queryITunesID);
            }
        });
        alert.show();
    }
};
 
checkButton.addEventListener('click',function(e){
    appStoreHelpers.versionCheck(queryITunesID,queryResults);
});
 
win.open();
But when I try same functionality for android, I can't find anything. Please give the details about that?

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>