简体   繁体   English

Titanium:检查设备上是否安装了应用程序(android)

[英]Titanium: Check if application installed on the device (android)

How i can check if application installed on android device (for eg by application id - com.foo.bar) ? 我如何检查Android设备上是否安装了应用程序(例如,通过应用程序ID - com.foo.bar)? Or, how i can get list of all android application installed on the device? 或者,我如何获得设备上安装的所有Android应用程序的列表? Im use titanium mobile. 我用钛金属手机。 Thanks! 谢谢!

You can get the all the installed applications like this.. 您可以获得所有已安装的应用程序。

Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
    mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
    List<ResolveInfo> appData = packageManager.queryIntentActivities(
            mainIntent, 0);
    for (ResolveInfo appInfo : appData) {
        Application application = new Application();
        application.setApplicationName(appInfo.loadLabel(packageManager)
                .toString());
    }

The code that was written here is indeed a Java code. 这里编写的代码确实是一个Java代码。 I don't think Titanium exposes a methods that access the information you are looking for. 我不认为Titanium公开了一种访问您正在寻找的信息的方法。

What you can do is write your own native Titanium Module in Java that uses that uses the code kalyanpvs wrote you and use it from within javascript. 您可以做的是用Java编写自己的原生Titanium模块,使用kalyanpvs编写的代码并在javascript中使用它。

Check this out http://docs.appcelerator.com/titanium/latest/#!/guide/Android_Module_Development_Guide to learn more about module development for Android in titanium. 请查看http://docs.appcelerator.com/titanium/latest/#!/guide/Android_Module_Development_Guide ,了解有关Android钛模块开发的更多信息。

I'm guessing at your requirements slightly but it is possible to link a url to your app. 我正在猜测你的要求,但可以将网址链接到你的应用程序。

When you try and load that url from any source (eg an sms, an email) it will open the app if you have it, or else it will just open the url in your browser. 当您尝试从任何来源(例如短信,电子邮件)加载该网址时,如果您拥有该网址,它将打开该应用,否则它只会在您的浏览器中打开该网址。

See here: Android Respond To URL in Intent 请参阅此处: Android在Intent中响应URL

Does that help at all? 这些帮助有用?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 即使已将android应用程序从设备中删除,如何检查是否已安装 - How to check if an android application was installed even if it is removed from the device 如何在Android设备中使用googlePlay检查已安装的应用程序 - How to check installed application using googlePlay or not in android device 检查是否安装了应用程序 - Android - Check if application is installed - Android 检查设备上是否安装了Google Maps应用程序 - Check if the Google Maps application is installed on the device Android设备上的Facebook身份验证导致应用程序失败(Titanium android) - Facebook Authentication on android device causes failure of application (Titanium android) Check App安装在设备安卓代码上 - Check App is installed on device android code 如何检查 Android 设备上安装的 Fonts - How to check Installed Fonts on Android Device 如何查看 android 设备中是否安装了 Whatsapp? - How to check Whatsapp is installed in device in android? 无法在eclipse上相同的Titanium Studio的设备上运行android应用程序 - unable to run android application on device from titanium studio same on eclipse 已安装Android应用程序,但无法在设备上打开 - Android Application Installed but won't open on device
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM