How to check if Facebook is installed or not WP8? - windows-phone-7

Below link help to open facebook app, If, installed
Launcher.LaunchUriAsync(new Uri("fb://"))
I need to know facebook installed or not like below condition,
if(installed)
{
//my code
}
else
{
"not installed"
};
Thanks

You cannot check if third party apps like Facebook, Soundhound are installed. The only thing that you can check is the list of apps those you published that are installed on the device.
You can try this out,
var success = await Windows.System.Launcher.LaunchUriAsync(new Uri("fb://"));
if (success)
{
// URI launched
}
else
{
// URI launch failed
}

Nop, you can't check whether a third party application is installed unless if it's an application that you developed.
Reference: How to check if user has installed specific app on the WP8 device

Related

Which event type is triggered when a slack app is installed onto a workspace for the first time?

I'm trying to build an app that does something when it is first installed onto a workspace, eg: Ping every team member.
I couldn't find an event type that gets triggered upon app install:
https://api.slack.com/events
Is there a way to make this happen?
I think there might be a misunderstanding of the events concepts here. Events are always directly linked to one specific Slack app and needs to be processed by that very app. There is no such thing as "general" events for things happening on a workplace, like a new app being installed. Ergo there is no event for app installation.
Nevertheless you can implement the functionality you mentioned with Slack, e.g. pinging all team members once an app is first installed. All you need to do is include this function in the installation process of your Slack app and e.g. start pinging after the installation process is complete and the app verified that it was the first installation to this workspace. You do not need an event for that.
This is a partial answer because I was wondering the same thing and wanted to share what I found. On this oauth tutorial, it has the following code snippet:
app.get('/auth', function(req, res){
if (!req.query.code) { // access denied
return;
}
var data = {form: {
client_id: process.env.SLACK_CLIENT_ID,
client_secret: process.env.SLACK_CLIENT_SECRET,
code: req.query.code
}};
request.post('https://slack.com/api/oauth.access', data, function (error, response, body) {
if (!error && response.statusCode == 200) {
// Get an auth token
let oauthToken = JSON.parse(body).access_token;
// OAuth done- redirect the user to wherever
res.redirect(__dirname + "/public/success.html");
}
})
});
I believe instead of the line res.redirect(__dirname + "/public/success.html"); at that point you can make a request to ping everyone or even call a function to do so directly there, and it will trigger immediately once the app has been installed.

Laravel redirect user to playstore app of android when someone access a url(GET REQUEST) in browser of android device

I am trying to redirect a user to android playstore or ios playstore where my app is stored when they visit my website.I want to achieve this with laravel.
I got the status of the device they are using:
$agent = new Agent();
if($agent->isMobile()|| $agent->isTablet()){
if($agent->isAndroidOs()){
return "android";
}
elseif($agent->is('iPhone')){
return "ios";
}
}
else if($agent->isDesktop()){
$browser = $agent->browser();
echo "Browser:".$browser."<br>";
echo "Platform:".$agent->platform()."<br>";
echo "Version of Platform:".$agent->version($agent->platform())."<br>";
echo "Device:"."Desktop";
return redirect('http://google.com');
}
else{
return "Couldn't identify";
}
Here,is the output:
preview of the output when I access in my browser
Browser:Chrome
Platform:Windows
Version of Platform:6.1
Device:Desktop
The above code works fine.What I need now is,I want to find a way to redirect the user to store and display the app I specify in ios,android.
Can anyone give me the code to do that.I know that this can be done with the headers the server receive.But,I don't know how to use it in the code.
Please help.I want to do this in laravel 5.1.
Found an answer to my own question.When we open our application in of google play website and that link is redirected automatically to the playstore.
if($agent->isMobile()|| $agent->isTablet()){
if($agent->isAndroidOs()){
return redirect('https://play.google.com/store/apps/details?id=com.rovio.angrybirds&hl=en');
}
elseif($agent->is('iPhone')){
return "ios";
}
}
Found from: Opening app in Google Play from a redirect link

Codeigniter is_mobile function for Google bot

I am using codeigniter and I have mobile and desktop site.If user comes from mobile I am checking it with $this->agent->is_mobile() method then if user is mobile I am redirecting to mobile url.It works well for mobile devices.
But I am testing my site with this tool:https://www.google.com/webmasters/tools/mobile-friendly/ It is not redirecting to mobile website.I think is_mobile() method is not returning true for google mobile bot.
What should i do ?
You could use:
$this->agent->agent_string();
to return the user-agent and then manually check it against the googlebot user agents; see the link below for details of the user-agents currently in use by Google Webmaster Tools:
https://developers.google.com/webmasters/mobile-sites/references/googlebot
Had the same problem, apparently if the agent is detected as robot (in that case googlebot) it won't test if it's mobile too.
The following snippet is from the User_agent system library (line 150), look at the "break" instruction.
function _compile_data()
{
$this->_set_platform();
foreach (array('_set_robot', '_set_browser', '_set_mobile') as $function)
{
if ($this->$function() === TRUE)
{
break;
}
}
So you either remove the "break" or you extend the library.

Windows Phone: Navigate between apps

I have an app that needs to include a links to a second app in the same phone.
If the app is not installed the link should point to the windows store to install it (that part is working fine).
But if the app is already installed the link should go straight to the app and open it. How can I do that?
The app has two versions one form WP7 and other from WP8. if the solution is different for them please point the difference.
Thanks for the help...
I believe a URI Association is what you want. You should be able to create a different association in your WP7 app and in your WP8 app, and handle them accordingly.
A URI association allows your app to automatically launch when another app launches a special URI.
Also note:
If you are interested only in launching your own apps, consider using
APIs from the Windows.Phone.Management.Deployment namespace. You can
use this API to check for other apps that you’ve published, and then
launch them if they’re installed.
You basically just need to update the WMAppManifest.xml file to include the URI Association and then listen for that URI. Example:
<Extensions>
<Protocol Name="contoso" NavUriFragment="encodedLaunchUri=%s" TaskID="_default" />
</Extensions>
Then you can use a custom URI Mapper to handle your association (full example in top link above):
public override Uri MapUri(Uri uri)
{
tempUri = System.Net.HttpUtility.UrlDecode(uri.ToString());
// URI association launch for contoso.
if (tempUri.Contains("contoso:ShowProducts?CategoryID="))
{
// Get the category ID (after "CategoryID=").
int categoryIdIndex = tempUri.IndexOf("CategoryID=") + 11;
string categoryId = tempUri.Substring(categoryIdIndex);
// Map the show products request to ShowProducts.xaml
return new Uri("/ShowProducts.xaml?CategoryID=" + categoryId, UriKind.Relative);
}
// Otherwise perform normal launch.
return uri;
}
Hope this helps!
Is the secondary app one that you have created? If so, do something like this:
IEnumerable<Package> packages = InstallationManager.FindPackagesForCurrentPublisher();
foreach (Package package in packages)
{
if (package.Id.ProductId.ToString().ToLower() == "product id of secondary app")
{
//Launch the app
package.Launch();
}
}
Make sure that your publisher ids match in the WMAppManifest for both apps.
If this secondary app was published by someone else, you'll need to use a custom Uri schema. The app needs to have this feature added by the developer, you can't just launch any app.

How to detect in Safari if an Application is Installed

I'm attempting to write a simple plugin in safari that only needs to check if an application I have developed is installed via javascript. The application launches using a custom uri.
My issue is very similiar to the one presented here, however I'm not developing against iphone\ipad and all I really want is a true\false outcome from my check so that I can present the user with a 'download application or 'launch application' link.
I already have a windows version that works using npruntime for firefox\chrome and ATL for IE which is described here
Launch Services is the API you need. See the example below:
#include <ApplicationServices/ApplicationServices.h>
bool check_scheme_handler(CFStringRef scheme){
CFStringRef handler=LSCopyDefaultHandlerForURLScheme(scheme);
if(handler){
CFShow(handler);
CFRelease(handler);
return true;
}else{
CFShow(CFSTR("not found"));
return false;
}
}
int main(){
check_scheme_handler(CFSTR("http"));
check_scheme_handler(CFSTR("bogus"));
return 0;
}

Resources