In case of Android phone I checked a condition using.
if (userAgent.contains("Mobile"))
but how to check for windows phone or i-phone? not for tablet.
In case of windown phone Will i check many conditions for browser like uc-browser or opera mini.
please confirm me Does userAgent contain common string? using this we recognize request comes from mobile?
You can use the following code to detect Mobile in iOS devices :
if (navigator.userAgent.match(/(iPhone)/))
return true;
And you can detect mobile device for android OS as described by Google in the following link:
https://googlewebmastercentral.blogspot.com.au/2011/03/mo-better-to-also-detect-mobile-user.html
And for Windows Phone use the following condition:
if(navigator.userAgent.match(/Windows Phone/i) ||
navigator.userAgent.match(/iemobile/i) ||
navigator.userAgent.match(/WPDesktop/i)){
return true;
}
Related
By running ionic cordova run browser device uuid is null as Device object is empty on browser platform.
Device info should be there as it supports browser platform like
platform: browser
uuid: "someid"
Here's my code:
import { Device } from '#ionic-native/device/ngx';
constructor(private device: Device) { }
console.log('Device UUID is: ' + this.device.uuid);
Result: Device UUID is: null
I'm using #ionic-native/device": "^5.5.0
Please help me out how to resolve this problem. I have tested the code on android device. It's working fine
Sadly the device.uuid property is not supported on the browser platform. See the supported platforms here.
So you might want to check the device.platform beforhand and handle the browser platform differently something like this:
if (this.device.platform === 'browser') {
console.log('Device UUID is not supported on browser platform');
} else {
console.log('Device UUID is: ' + this.device.uuid);
}
Description
When the Facebook app is not installed, canShareVia method should invoke the error callback, which is working perfectly with my iPhone5s running iOS 10.
When I test it on iPhone5s running iOS 11.2, it is always invoking the success callback in both the cases where the Facebook app is installed and Not installed.
App
A Cordova mobile app
Plugin: https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin
Device information
iPhone 5s
iOS 11.2
Facebook app: Not installed
Sample code
window.plugins.socialsharing.canShareVia('com.apple.social.facebook', 'msg', null, null, null,
function(success) {
do some stuff....
}, function(error) {
alert(error);
});
Please let me know if any work around has been found.
Updated
Found the cause:
This plugin always returns true since iOS11. So we might need another way to detect if there is an app installed and available.
Get it to work with cordova-plugin-appavailability.
You can implement this way (Appavailability plugin to check Facebook app availability and social sharing plugin to do the actual sharing).
appAvailability.check(
'fb://',
function() { // Success callback
window.plugins.socialsharing.shareViaFacebook(...)
},
function() { // Error callback
console.log('Facebook App is not available');
}
);
Though this is a work around but not a fix, this is the only way for now until the fix gets merged to cordova-plugin-x-socialsharing.
You can find the answer for your question here.
App Availability.
Read this and your requirement will be piece of cake.
My HoneyComb application runs on tablets and Google TV. I have setting to send email in my settings fragment, but it returns error of "No app can handle this function."
Is there a way to send email to browser through my application if there is no client (createChooser) available?
I also tried to display a summary of the customer service email, but summary is not working on HoneyComb. I was trying this so I could have disabled Intent on tv.
Is there a way to send email to browser through my application if there is no client (createChooser) available?
Not unless you know the specific email Web app and all of its details, and that email Web app supports some sort of direct-email-sending capability.
Either prompt the user to install an email app, or send the email yourself (e.g., JavaMail), or do not use email for communications on Google TV. I would expect few Google TV users to be using email on their televisions, so you need to plan accordingly.
Google TV includes a default, stub email app, so the system will appear to have an email app installed, even when there is none. There's a special check necessary to detect the stub:
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setType("plain/text"); // special mime legacy for gmail; others work
List<ResolveInfo> match = getPackageManager().queryIntentActivities(emailIntent, 0);
boolean hasEmailer = match.size() > 0;
Log.w("thuuz", "has plain/text Emailer: " + hasEmailer);
if (match.size() == 1) {
ResolveInfo info = match.get(0);
boolean real = true;
if (info.activityInfo.packageName.startsWith("com.google.android.tv.frameworkpackagestubs"))
real = false;
Log.w("thuuz", "has *real* Emailer: " + real);
}
For our iPhone native application we have a URL : example://
On the iPhone if I type this URL (example://) in safari it automatically opens up my application.
From my "regular" website I have a link which when the user clicks it opens the application. The problem is that if the application is not installed on the iPhone it throws "Unable to open" error.
So before rendering the link on my "regular" site I need to check if the app is installed, one solution is to make an Ajax call and check for status code:
$.ajax({
type: 'POST',
url: 'example://',
complete: function (transport) {
if (transport.status == 200) {
alert('Success');
} else {
alert(transport.status);
alert('Failed');
}
}
});
But this code is always returning a status code "0".
Is there a way to find out from the web if the native iPhone app is installed?
If u are referring to Mobile Safari, you're out of luck. There's no documented public API that I know of that can do this. Mobile Safari is sandboxed away from the OS.
If it's in a webview within an app, u can request the URL and let the webview delegate talk to the native app / query the handling of example://. Otherwise, no way the browser can know existence of any installed app.
How do you start the Mail app from a Titanium app?
I am looking for the equivalent of an HTML mailto: link where I can specify the email and maybe the subject from with in a windowView.
I am not using a webView.
Will
Try this one:
var emailDialog = Titanium.UI.createEmailDialog();
emailDialog.subject = "Sending email from Titanium";
emailDialog.toRecipients = ['name#gmail.com'];
emailDialog.messageBody = 'Appcelerator Titanium - Testing sending email';
emailDialog.open();
But remember that you cannot test this send email feature from iPhone Simulator (because iPhone simulator lacks of setting email account). Try to check in real phone.