Is there a way to identify the if the mobile is compatible with Augmented Reality and if its not show a notification? - augmented-reality

I'm trying to notified the user if the mobile that he is using is compatible with augmented reality. I would like to identified if the mobile is compatible and then if its not show a simple notification like: "your mobile is not compatible with AR". I use model-viewer as base.
Can you guys help me?
I tried
if (navigator.xr) {
navigator.xr.isSessionSupported('immersive-ar').then(function (supported) {
if (supported) {
console.log("AR is supported on this device");
} else {
console.log("AR is not supported on this device");
alert("Augmented reality is not supported on this device. Please try using a different device.");
}
});
} else {
console.log("WebXR API is not supported on this device");
alert("WebXR API is not supported on this device. Please try using a different device.");
}
__
This code should will display an alert message using the alert function if the device either does not support the WebXR API or if it does not support the 'immersive-ar' session mode.
But isn't working. It is showing for everyone this message.

Related

Does web VR mode no longer work in Safari on iOS13?

I have a website that creates a vr experience using the device accelerometer that no longer works on Safari in ios13. Does anyone know if this feature was removed? I know in iOS12 it was moved behind a Safari setting, but that setting is no longer available in iOS13. Oddly, it does still work using the chrome browser on iOS13.
They removed to option in the settings page, and introduced an api instead.
Which is better because now the user gets a dialog asking the user for permission instead of having to go into the settings.
function onClick() {
// feature detect
if (typeof DeviceMotionEvent.requestPermission === 'function') {
DeviceMotionEvent.requestPermission()
.then(permissionState => {
if (permissionState === 'granted') {
window.addEventListener('devicemotion', () => {});
}
})
.catch(console.error);
} else {
// handle regular non iOS 13+ devices
}
}

iOS 10 - WLAN Access Setting Doesn't Appear In Some iOS Devices

Our app is using WLAN to communicate with a wireless device. When our app is installed in iOS 10. Sometimes, udp socket doesn't work. The reason for that is, in iOS 10 they added a new setting or permission under your app that allows the user to switch on or off the user of WLAN or cellular data.
The following would appear in the settings of the app:
When I tap on the Wireless... It will bring me to this UI:
After allowing WLAN use. The app would work fine.
Now, the problem is, sometimes, or in some devices running iOS 10, the settings that I just showed you doesn't appear(I am referring to the setting shown on the first image). So, is there anything I can do to make that settings always appear? It seems that sometimes iOS system doesn't recognize that my app is using wireless data. And it would result in my app would never get to use WLAN forever.
There is no user permission to use WIFI in iOS10.
The application in your screenshot (BSW SMART KIT) is using Wireless Accessories (WAC), i.e. is able to connect to wireless speakers. To accomplish this the Wireless Accessory Configuration capability is required. This is what you can dis/enable in the systems settings (your screenshot).
The switch in the settings shows up after connecting to a device via WIFI through WAC. You can see this behaviour in your sample app (BSW SMART KIT) too.
This sample code might let you get the idea. Detailed information in Apples documentation.
After a time of researching. I ended up seeking help with Apple Code Level Support. Apple states that this problem would most probably occur when you reskin your app. They say that probably it's because of the Image UUID of the main app and the reskinned app are the same. When you install both of them in your phone, the system will treat the reskinned app as the same app compared to the main app. So, if the one app fails to access WLAN, then it will also affect the other one. According to them, this appears to be a bug in iOS. And currently, they don't have any solution for the developers. This is the radar bug number:
What I did to somehow lessen the occurrence of the problem is to add tracking to the Network Restriction by using the following code.
- (void)startCheckingNetworkRestriction
{
__weak AppDelegate *weakSelf = self;
_monitor = [[CTCellularData alloc] init];
_monitor.cellularDataRestrictionDidUpdateNotifier = ^(CTCellularDataRestrictedState state)
{
[[NSOperationQueue mainQueue] addOperationWithBlock:^
{
NSString * statusStr;
switch(state)
{
case kCTCellularDataRestrictedStateUnknown:
{
statusStr = #"restriction status:Unknown";
}
break;
case kCTCellularDataRestricted:
{
statusStr = #"restriction status:restricted";
[weakSelf performUrlSession];
}
break;
case kCTCellularDataNotRestricted:
{
statusStr = #"restriction status:not restricted";
}
break;
default:
{
abort();
}
break;
}
NSLog(#"Restriction state: %#", statusStr);
}];
};
}
Take note that you have to import CoreTelephony to do this.
#import CoreTelephony;
when I detect that the network is restricted. I will open a URL session to force internet access attempt and would hope that the restriction alert dialog would pop out. Once the alert is pop out, then the WLAN Access Settings that I was talking about would definitely appear under the settings. There are times that this doesn't work. If it happens, then you'll just have to rename the bundle ID, and make a couple of changes to your code and then rebuild it a couple of times (Well, that's what I did when I was experimenting this). Reinstalling the app won't do a thing. Restarting and resetting the phone won't do either.
Hope this helps.

Does this code pass the app store?

I need to know if user has certain apps on his iphone device
I have this code
BOOL isInstalled = [[LSApplicationWorkspace defaultWorkspace] applicationIsInstalled:#"com.app.identifier"];
if (isInstalled) {
// app is installed }
else {
// app is not installed
}
which in theory does the job
the question is in practice, does it pass the app store?
can i use the "LSApplicationWorkspace" class ?
No.
All applications referencing private APIs and even undocumented APIs are not allowed.

iOS 7: is it possible to find other running apps in iphone(like taskmangaer in windows)

I am developing a kind of gaming application where I need to handle the following:
`if(user used siri app)
{
// Send notification:1 to server
}
elseif(user attended a call)
{
// Send notification:2 to server
}`
Does it possible to handle above cases inside my app ? Please guide me.
Thanks in Advance.
I am aware of applicationDidEnterBackground which can be used when app is sent to backgound.
But it will be great if I can find abouve cases.
No. This information is not available to an app.

Check if BlackBerry gps is enabled

I am developing an app in which I have to check programmatically if gps is enabled or not for locations in phone? How do I find this?
if (!LocationInfo.isLocationOn()) {
try {
LocationInfo.setLocationOn();
} catch (ControlledAccessException cae) {
// You don't have the rights to enable GPS programatically.
// You might want to prompt the user for it.
}
}
You might also want to have a look at the following functions:
LocationInfo.isLocationSourceAvailable(int mode) -
Determines if a specific location source is available to provide location information.
LocationInfo.isLocationSourceSupported(int mode) -
Determines if a specific location source is currently supported on the device.
gl
All new BB have on device GPS. You just need to make sure it is set correctly.
First make sure you set GPS Data Source == Device GPS in the Options->Advanced Options app.

Resources