1336
Views
8
Comments
Solved
How to know if twiiter or instagram or any other app installed on phone
Question

In our mobile app, we want to check if an app like twiiter or instagram has been installed or not. How to achieve this ?

In android, we can find using the following line:

PackageInfo info= getPackageManager().getPackageInfo("com.twitter.android", 0);


How to achieve the same in Outsystems ?

Staff
Rank: #292
Solution

Hello, Kartick,

From my understanding, the plugin uses an asynchronous callback to return its results. As such, you will need to use '$resolve()' to make the JS node hold the execution of the client action until it is called, as described here.

There should be a similar pattern on the Location plugin's 'WatchPosition' action, so you could download it and check its code.

Please let me know how it went.

Best regards,

Carlos Simões

Staff
Rank: #292

Hello, Kartick,

This is kind of an advanced scenario, so I'd look for a plugin to achieve it.

Have you had a look at this plugin? It looks like it supports Id lookup for Android and scheme-based lookup, which our OutSystems Mobile apps include.

Please let us know if it solved it for you!

Best regards,

Carlos Simões

Rank: #16676

Thanks Carlos, your reply was helpful.

From the link that you shared, I created a new mobile application, then created blank module, added the following in the "Extensibility Configurations"

{
    "plugin": {
        "url": "https://github.com/ohh2ahh/AppAvailability.git"
    }
}

Then created a client action, added a java script with the following code:

$parameters.Exists='false';

appAvailability.check(    'com.twitter.android', // Package Name

     function() {           // Success callback    

     $parameters.Exists='true';    },  

  function() {           // Error callback        

$parameters.Exists='error';    });

Then I have an assign to assign the Exists parameter to the out parameter.

When I called the client action from another application, the value of "Exists" is  "false" even though the twitter app is installed on the phone. Why is the plugin not working ?


 

Staff
Rank: #292
Solution

Hello, Kartick,

From my understanding, the plugin uses an asynchronous callback to return its results. As such, you will need to use '$resolve()' to make the JS node hold the execution of the client action until it is called, as described here.

There should be a similar pattern on the Location plugin's 'WatchPosition' action, so you could download it and check its code.

Please let me know how it went.

Best regards,

Carlos Simões

Rank: #16676

Thanks Carlos, it worked fine after implementing asynchronous callback.

Can I post the application to forge, so that others can use it ?


Staff
Rank: #63

Hi Kartick,


Make it available on the forge, that would be great.


Thank you!

Rank: #16676

Sure Daniel, thanks.

Carlos,

It is not working for iOS. Any idea why ?

I saw in documentation that for iOS, the following has to be done:

Add URL Schemes to the Whitelist

Simply open your app's .plist (usually platforms/ios/<appname>/<appname>-Info.plist) with an editor and add the following code with your needed Schemes.

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>twitter</string>
    <string>whatsapp</string>
</array>


But how to do this in outsystems ?

Rank: #16676

how to add .plist file for iOS using outsystems.

Rank: #77622

Hi,

Is there any way where we can detect from a web page whether the apps(facebook, messenger, instagram) were installed?

Thanks in advance.