Skip to content

Instantly share code, notes, and snippets.

@yagitoshiro
Last active August 29, 2015 14:19
Show Gist options
  • Save yagitoshiro/d6e0e17e9566801c8eaf to your computer and use it in GitHub Desktop.
Save yagitoshiro/d6e0e17e9566801c8eaf to your computer and use it in GitHub Desktop.
Google Play Servicesの最新版が入っているか確認する
if(Ti.Platform.osname == 'android'){
var MapModule = require('ti.map');
var rc = MapModule.isGooglePlayServicesAvailable();
if(rc != MapModule.SUCCESS){
var dialog = Ti.UI.createAlertDialog({
title: 'ご利用の前に',
message: '本アプリを快適にご利用頂くために必要なアプリがあります。インストールしますか?',
buttonNames: ['インストールする', '今回はキャンセルする']
});
dialog.addEventListener('click', function(e){
if(e.index === 0){
var url = "market://details?id=com.google.android.gms";
Ti.Platform.openURL(url);
}
});
dialog.show();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment