Do we need to ask Google assistant for permission every time? - actions-on-google

I am building an app that requires Device( Google Home/ Phone ) location. Do we need to request for permissions each time?

Unfortunately, yes. See Google Assistant location permissions not stored between requests
Where possible (ie - for the name) you should cache this against the UserId.
Clearly this isn't reasonable for location. I usually suggest coming up with a set of phrases to use to ask for location instead of just one to at least mitigate how frustrating it can be for the user.

Unlike mobile phone app permissions systems, there is no memory of if a user has previously granted your app a permission. So one option is to ask every time. A better option is to store the result in your backend for future use. However, you should avoid storing sensitive data (such as precise location) due to user privacy issues.
If, for example, you are wanting to store nearby train stations, you could ask for their location via the permission, query for nearby train stations using that location and then store the nearby train stations against their userId.

Related

How to store data for a household

I'm looking for a way to store data for a Google Assistant action for all devices/users in a household, without requiring voice matching to identify a user.
I know you can store data in user.storage, but I don't necessarily want to require voice matching to link to a user, and if I use user.storage the data will only be associated with one user. I just want anyone on any of the devices (Google Home) in the household to be able to use the data persisted in the action.
One approach could be to obtain the device ID (if possible) when setting up the action and store the data by device ID. Then link all other devices in the household by device ID through the list of devices associated with the original user's account (if that's possible). Any other options?
This is currently not possible, there's no way to save data and have everyone in the household access it. I'm sure you've already seen the documentation on Save Data in a Conversation.
On shared devices like Smart Displays and Speakers, personal results are turned off by default. They can be enabled again following these instructions:
Open Assistant settings on your Android phone
Select device in "Assistant devices"
Turn Personal results on.
But this means other household members can see personal results, e.g. Calendar entries.
To determine if you will be able to use userStorage, you can use the recently launched GUEST/VERIFIED flag, see documentation here.
User storage is designed to work at a user-only level. If you don't have something like voice match setup, user storage will not persist. The best approach to having family or multi-person data sharing would be to use something like Google Sign-In to get their email, and then have a companion service like a website where users can share access with other emails. Then your service can pull from a common data source.

Action with different fulfilment URL based on user's location

I work for a company that is building a Google Action which will be available in AU, NZ & UK. Depending on the location of the user, the fulfilment URL needs to be different as each country has its own APIs, etc.
We could achieve this easily by deploying three separate apps, restricted to their particular country, each having their own fulfilment URL. However, if my understanding is correct, they would all have different invocation names which is not ideal.
Another way we could potentially achieve this is by making the user choose which market they want (AU, NZ, UK) on the account linking page and then use the APIs for that market. However it doesn't seem to be a great UX.
Ultimately the key goals we're trying to achieve are
Users in AU, NZ & UK can all invoke the Google Action by saying "Ok Google, Open App", rather than "Ok Google, Open App NZ", "Ok Google, Open App UK", etc.
Users don't have to choose market (AU, NZ, UK) they belong to - it happens automatically
We can use the correct API based on the market the user belongs to.
There is no way to have different fulfillment URLs for the same Action.
You also have a slight issue when getting their location - you need to request it explicitly from them. Once you have this, however, you can store it (with their permission) to use it again in future requests, so you only have to do it once.
You will need to check to make sure it is one of the locations you serve, and you may want to allow them to change it (what if someone from the UK is traveling to AU?).

How facebook detects my location so precisely only based on IP address?

I have two-step authentication on facebook. I just tried to log in from my home PC but didn't write second step code.
I've got notification that somebody (me) was trying to login to my account and location was so precise (within 2 meters).
I wondered how facebook detects location so precisely only based on IP?
Today geolocation is in the core business of Marketing companies, there's a very developped market of customer data, so tons of mobile apps and services collect data such as usual IP addresses, personal information, interests, locations.
That information gets reselled to data brokers, aggregated, corrected. And then Facebook or others can buy that data, merge it, implement corrections and so and get tables for matching IPs and locations that are not public, it seems.
However they offer a high level API to perform market targeting which seems to use that data:
https://developers.facebook.com/docs/marketing-api/buying-api/targeting#location
In your case it was precise because they may have a good dataset based on your privacy settings experience, not only with facebook but with other geo-located apps. In my case their guess is wrong by hundreds of Km, because I was behind a corporate proxy.

How to Share GPS Location iOS

I have seen some apps that offer functionality to share location via email or SMS. I have done a good amount of searching and haven't found much regarding this. Is it because all that is shared are the longitude, latitude information (thus being very simple)?
You need to grab location information and use a transportation medium (email, TCP/IP, HTTP) to send it to a remote site. There is no automatic way of sharing that.
For this you have to fetch Current location of user with the help of core location and with the help of this latitude longitude you can share a google map link to other user via facebook, gmail or any social media.
You need to use CLLocationManager to subscribe for location updates. They are happening asynchronously and every second. You may control precision and some other parameters. Once you get it, you need to push a notification to another device thru your service or something like Urban Airship. I build my app like that https://itunes.apple.com/us/app/citrus-location/id777381230?ls=1&mt=8.
Here is more info from Apple: https://developer.apple.com/library/ios/documentation/userexperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html

How do I determine my total app users from a specific country?

I want to find out how many app users I have from a specific country. I know insights will show me how many users I have in each of my top twenty countries, but does anyone know how to find out your total number of app users from a country that is not in your application's top twenty?
Your options are basically:
Check the user's current IP with something like GeoIP
... I did some testing with GeoIP in the past, but the results didn't really convince me
Implement analytics code (I'm currently using Google Analytics)
If, and only IF this information is absolutely critical then you should look into the "user_location" and "user_hometown" permissions.
PS: Remember to update your Privacy Policy if you are going to do anything with the user's IP