Titanium: Open Privacy -> Location Services programmatically - ios8

the following code is able to successfully launch my App's settings programmatically (iOS 8) in Titanium:
var settingsURL = Ti.App.iOS.applicationOpenSettingsURL;
if (Ti.Platform.canOpenURL(settingsURL)) {
Ti.Platform.openURL(settingsURL);
}
The problem is that if a user has turned off their Location Services inside the Privacy page he/she won't be allowed to change this inside the App's settings, requiring the user to go back into Settings -> Privacy -> Location Services. This is very bad for the user experience-wise.
I know it is possible to launch the Privacy -> Location Services directly, since many apps do, like: Hotel Tonight, Foursquare, Dojo, etc.
How to do this in Titanium?
My configs: SDK 3.5.1GA & iOS8.

No, there is no API available.
In iOS 8 you can open setting but not Location setting directly
there was some url schemes to open setting functionality, example
Ti.Platform.openURL('prefs:root=LOCATION_SERVICES');
but apple removed this from iOS 5.1. So it will not work on 5.1 and greater.

For this to work you need to try to create a listener to Titanium.Geolocation, something like:
Titanium.Geolocation.addEventListener('location', locationCallback);
Keep in mind you need to do this even without checking that you have permission, this way iOS will prompt you to turn on location services using an alert dialog and thus you can be redirected directly to Privacy->Location Services.

Related

G Suite Marketplace SDK change visibility from My Domain to Public?

I've enabled a G Suite Marketplace SDK but initially I set the Visibility to "My Domain" so I could test in isolation on my domain. Now I want to set it to Public but that setting is disabled.
Warning: Once you select and save a visibility setting, you cannot change it later. (https://developers.google.com/gsuite/marketplace/sdk)
However I can't even disable/delete that API configuration and recreate it, so I can set it to public.
Is there any way to change this GSuite Marketplace API configuration to Public? (without having to tear down the entire Google Project and all it's API configurations and start over... seems there should be a better way)
Thanks
Try to access your Developer Dashboard and click the edit part of your item. You can check there if you can set the visibility option of your item.
I think once you change it, it will undergo a manual review and you need to wait some time to be approve.
I contacted Google support and confirmed that the only way to resolve this is to create an entirely new app and choose Public the first time you save it. I hope that helps.

Cordova: Launching chrome with --allow-file-access-from-files from VS 2017

I'm working on a cordova application in Visual Studio 2017 and I'm trying to access the filesystem using the file plugin. Unfortunately this does not work when debugging the application using 'Simulate in browser' (using cordova-simulate).
A 'SecurityError: It was determined that certain files are unsafe for access within a Web application, or that too many calls are being made on file resources.' error is raised.
I guess if have to pass '--allow-file-access-from-files' option to chrome, but I don't know how to do this, because chrome is launched automatically in a new window and I cannot find any configuration options in Visual Studio.
Some Chrome Quirks are:
Chrome filesystem is not immediately ready after device ready event. As a workaround you can subscribe to filePluginIsReady event.
Example: javascript window.addEventListener('filePluginIsReady', function(){ console.log('File plugin is ready');}, false); You can use window.isFilePluginReadyRaised function to check whether event was already raised.
window.requestFileSystem TEMPORARY and PERSISTENT filesystem quotas are not limited in Chrome.
To increase persistent storage in Chrome you need to call window.initPersistentFileSystem method. Persistent storage quota is 5 MB by default.
Chrome requires --allow-file-access-from-files run argument to support API via file:/// protocol.
File object will be not changed if you use flag {create:true} when getting an existing Entry.
Form above quirks use basic steps here:
At the time of writing this article, Google Chrome has the only working implementation of the FileSystem API. A dedicated browser UI does not yet exist for file/quota management. To store data on the user's system, may require your app to request quota. However, for testing, Chrome can be run with the --unlimited-quota-for-files flag. Furthermore, if you're building an app or extension for the Chrome Web Store, the unlimitedStorage manifest file permission can be used in place of requesting quota. Eventually, users will receive a permission dialog to grant, deny, or increase storage for an app.
You may need the --allow-file-access-from-files flag if you're debugging your app from file://. Not using these flags will result in a SECURITY_ERR or QUOTA_EXCEEDED_ERR FileError.

sandbox :get NSData using bookmarkDataWithOptions method of NSURL without NSOpenPanel

I enabled sandbox and I want to create data by bookmarkDataWithOptions.
If the URL is created by NSPanel that work very well. But, If I obtain URL without using NSOpenPanel, the bookmarkDataWithOptions method always return nil. why?
thank about If I want to set a special folder default can read/write without using NSOpenPanel.
How can i do?
Thanks
The main feature of the Sandbox is security. If an application could read/write an arbitrary folder without user permission, the security would be broken.
The App Sandbox Design Guide states clearly:
• Simulation of user input in Open and Save dialogs:
if your app depends on programmatically manipulating Open or Save dialogs to simulate or alter user input, your app is unsuitable for sandboxing.
The only way to achieve something similar, is to add a read/write entitlement to one of the preset directories (Documents, Pictures, Music, etc…). For further documentation, take a look at this guide.

URI scheme launching

I've been given a task to create a protocol similar to callto:, that - upon clicking on a link with it - would automatically launch an installed aplication.
I followed the microsoft guide on how a scheme should look like.
My scheme looks like this:
HKEY_CLASSES_ROOT
slican
URL Protocol = ""
DefaultIcon (Default) = "C:\Users\Okabe\Desktop\slican\SlicanP.exe,1"
shell
open
command (Default) = "C:\Users\Okabe\Desktop\slican\SlicanP.exe" "%1""
I thought that was all and tested it with
test link
test telephone link
There was no reaction whatsoever. Internet Explorer asked me if I want to search for a program that can open the content and Chrome responded with nothing, as if I clicked javascript:void(0).
How to get that worked?
Thank you for your help!
The registration you show works perfectly fine for me when I try it on Windows 7. The local app I registered in place of SlicanP.exe ran fine when I invoked a slican: URL from the Start | Run menu, and from within the address bar of Windows Explorer. So the registration works.
Do be aware that Internet Explorer runs in a lower integrity security context, so it may not have rights to run local programs. When I tried to click on an HTML link to a slican: URL, or type a slican: URL in the address bar, IE had trouble executing the local app (even after prompting for permission). I had to run IE as an administrator, then the local app ran just fine.
Also, you really should not be creating a HKEY_CLASSES_ROOT\slican key directly. Create a HKEY_CURRENT_USER\Software\Classes\slican (current user only) or HKEY_LOCAL_MACHINE\Software\Classes\slican (all users) instead. Refer to MSDN for more details:
HKEY_CLASSES_ROOT Key
Merged View of HKEY_CLASSES_ROOT
Update: Since it works in Windows 7, Microsoft probably changed how URL schemes are registered in Windows 8. For instance, phone/store apps use URI activation:
URI activation (XAML).
URI activation (HTML)
The documentation says there are two ways to register a custom URI scheme:
Internet Explorer uses two mechanisms for registering new pluggable protocol handlers. The first method is to register a URI scheme name and its associated application so that all attempts to navigate to a URI using that scheme launch the application (for example, registering applications to handle mailto: or news: URIs). The second method uses the Asynchronous Pluggable Protocols API, which allows you to define new protocols by mapping the URI scheme to a class.
You are doing the first. Try using the second instead.
However, I just noticed that "Asynchronous Pluggable Protocols" is listed on MSDN in the "Legacy APIs" section, and it has the following note:
Third-party protocol implementations won't load in Windows Store apps using JavaScript, or in the Internet Explorer in the new Windows UI.
So it may or may not work in Windows 8.
Update: I just found this:
Guidelines for file types and URIs
In Windows 8, the relationship between apps and the file types they support differs from previous versions of Windows.
Walkthrough: using Windows 8 Custom Protocol Activation
The file type and protocol association model has changed in Windows 8. Apps are no longer able to programmatically set themselves as the default handler for a file type or protocol. Instead, now the user always controls what the default handler is for a file type or protocol.
Your app can use existing protocols for communication, such as mailto, or create a custom protocol. The protocol activation extension enables you to define a custom protocol or register to handle an existing protocol.
Also have a look at this:
Setting mailto: protocol handler programmatically in Windows 8
And this:
Default Programs
if you go to C:\Users\\AppData\Local\Google\Chrome\User Data
You can edit the Local State file
Search for protocol_handler
The syntax here is a key value pair. I usually copy two mailto: and make sure that you set your protocols to false. This will mean that chrome will treat your new protocols as URI_Handler events
If you have troubles with configuring custom URI scheme, you can compare your own configuration with existing one. For example, "HKEY_CLASSES_ROOT/mailto" - most likely you have it already in your system.

Make our application show in access and defaults

We are developing our application to be a default e-mail program, and would like it to be one of the options in the Control Panel-> Add or Remove Programs-> Access and Defaults-> Custom-> Choose a default e-mail program: area. How is this done?
It's a rather simple registry change to add the application to the list in IExplore-> Tools -> Internet Options -> Programs -> E-mail: But apparently this is not the list that is displayed in the Access and Defaults area.
Here's the msdn page for Registering Programs with Client Types, which is what you need to do. It's a few registry keys, and there is even a sample for a mail client.

Resources