Android app with GPS voice directions - android

I'm trying to create a tourism app for Android.
I need the user be guided by voice. I've been looking at the googlemaps Android API but there's nothing about voice directions.
Do you know any workaround for this? Is there any other API/SDK that I could use to implement this?
Thanks in advance.

That's a very cool idea. However, I do not know if you're ready to reinvent the wheel to do that. In case you are, I also have a solution but let me first introduce the way I would solve this problem:
On Android, there is the intent system which allows you to call internal apps in order to make your job easier. So why wouldn't you launch the Directions app (Google Maps with a special intent) since the user likely is familiar with the UI and probably likes it? Also, with this solution, you do not need to take care about keeping your stuff updated, you just ask the system and it'll provide the solution out of the box. And it is much much easier to proceed this way. :)
To do that, you will use plain basic URI that the system will recognise:
String address = "My Fake Address";
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?daddr=" + address));
startActivity(intent);
After that, the user will be able to choose how he wants to go there and your job is done, the user is satisfied, and you did like 99% of the other apps (he has the vocal messages as well).
Then, if it is in your requirements to have it inside your app, it could be possible (based on Aster proposition) but you'll need to keep a track of the user yourself (to be able to send the good instruction at the right time). But first let's take a look at the Directions API of Google, if you correctly set up your App you should receive this kind of JSON (whole doc there):
{
"status": "OK",
"routes": [ {
"summary": "I-40 W",
"legs": [ {
"steps": [ {
"travel_mode": "DRIVING",
"start_location": {
"lat": 41.8507300,
"lng": -87.6512600
},
"end_location": {
"lat": 41.8525800,
"lng": -87.6514100
},
"polyline": {
"points": "a~l~Fjk~uOwHJy#P"
},
"duration": {
"value": 19,
"text": "1 min"
},
"html_instructions": "Head \u003cb\u003enorth\u003c/b\u003e on \u003cb\u003eS Morgan St\u003c/b\u003e toward \u003cb\u003eW Cermak Rd\u003c/b\u003e",
"distance": {
"value": 207,
"text": "0.1 mi"
}
},
...
... additional steps of this leg
...
... additional legs of this route
"duration": {
"value": 74384,
"text": "20 hours 40 mins"
},
"distance": {
"value": 2137146,
"text": "1,328 mi"
},
"start_location": {
"lat": 35.4675602,
"lng": -97.5164276
},
"end_location": {
"lat": 34.0522342,
"lng": -118.2436849
},
"start_address": "Oklahoma City, OK, USA",
"end_address": "Los Angeles, CA, USA"
} ],
"copyrights": "Map data ©2010 Google, Sanborn",
"overview_polyline": {
"points": "a~l~Fjk~uOnzh#vlbBtc~#tsE`vnApw{A`dw#~w\\|tNtqf#l{Yd_Fblh#rxo#b}#xxSfytAblk#xxaBeJxlcBb~t#zbh#jc|Bx}C`rv#rw|#rlhA~dVzeo#vrSnc}Axf]fjz#xfFbw~#dz{A~d{A|zOxbrBbdUvpo#`cFp~xBc`Hk#nurDznmFfwMbwz#bbl#lq~#loPpxq#bw_#v|{CbtY~jGqeMb{iF|n\\~mbDzeVh_Wr|Efc\\x`Ij{kE}mAb~uF{cNd}xBjp]fulBiwJpgg#|kHntyArpb#bijCk_Kv~eGyqTj_|#`uV`k|DcsNdwxAott#r}q#_gc#nu`CnvHx`k#dse#j|p#zpiAp|gEicy#`omFvaErfo#igQxnlApqGze~AsyRzrjAb__#ftyB}pIlo_BflmA~yQftNboWzoAlzp#mz`#|}_#fda#jakEitAn{fB_a]lexClshBtmqAdmY_hLxiZd~XtaBndgC"
},
"warnings": [ ],
"waypoint_order": [ 0, 1 ],
"bounds": {
"southwest": {
"lat": 34.0523600,
"lng": -118.2435600
},
"northeast": {
"lat": 41.8781100,
"lng": -87.6297900
}
}
} ]
}
So what could be possible is to take these html_instructions and to read them to the user with the Android TTS Lib when he is in a square around the start_location or the end_location. However, it can be very complicated to manage this square properly, that's why I would use the first option which is really respecting the Android Spirit.
BTW, here are the definition of these attributes:
start_location contains the latitude/longitude coordinates of the origin of this leg. Because the Directions API calculates directions between locations by using the nearest transportation option (usually a road) at the start and end points, start_location may be different than the provided origin of this leg if, for example, a road is not near the origin.
end_location contains the latitude/longitude coordinates of the given destination of this leg. Because the Directions API calculates directions between locations by using the nearest transportation option (usually a road) at the start and end points, end_location may be different than the provided destination of this leg if, for example, a road is not near the destination.

Related

AppInventor Trouble! (JSON-Indexing)

So what i partially achieved was to set an app that gets JSON text from a weather website of this form:
{
"base": "stations",
"clouds": {
"all": 20
},
"cod": 200,
"coord": {
"lat": 40.94,
"lon": 24.41
},
"dt": 1513711200,
"id": 735861,
"main": {
"humidity": 100,
"pressure": 1027,
"temp": 274.15,
"temp_max": 274.15,
"temp_min": 274.15
},
"name": "Kavala",
"sys": {
"country": "GR",
"id": 5684,
"message": 0.0039,
"sunrise": 1513662178,
"sunset": 1513695412,
"type": 1
},
"visibility": 10000,
"weather": [
{
"description": "few clouds",
"icon": "02n",
"id": 801,
"main": "Clouds"
}
],
"wind": {
"deg": 51.0029,
"speed": 3.07}}
decodes it into a list and store the results in some labelboxes in the app.The values i want to use from this JSON are:
("main": {"temp":}, "weather": {"main":}, "main": {"humidity":}, "wind":{"speed}".
I have managed to that quite efficiently using the integrated json decode function and indexing from App Inventor.
Photo of Block Code:
(SCREEN RED POINTER is supposed to be "weather": {"main":} value)
My problem is that for some cities(the app searches for data from the city name the user enters) the indexes for "weather": {"main":} and "wind":{"speed}" are different.Is there any way i can set up a check routine for this problem?
For example, for "weather": {"main":} the usual indexing as it can be seen in my code(image) is 11 2 1 4 2 of the created list.For the cities that have different index and respond with an error i think its 10 2 1 4 2.
OBJECTIVE:So what i want to do is find a way to check if the element on the 11 2 1 4 2 exists so i can use it,else look for the element with indexes 10 2 1 4 2 to use.
UPDATE:OBJECTIVE COMPLETE DESPITE THE JSON deformity 2 dependent look up in pairs fixed the issue!
Don't use nested select list item blocks as you are doing currently...
The better approach is to use the loopup in pairs block and the sequence of the data will not be important anymore...
How does the lookup in pairs block work?
Further links
JSON and list of lists: example1 and example2
Easy to decode large information with JSON format by Carlos
A general purpose JSON browser routine by ABG
JSON Tools Extension by LukeGackle

How to add own tile in Mapbox 4.1

I have a source for tiles as an url and want to add these to my map.
I am able to do this with Google Map and OSMDroid, but I do not know how to figure it out using Mapbox.
My url has the format "http...mysource..x=..y=..z=.."
I have seen a solution for web, but I do not find such an approach for mobile.
I assume you have a URL for a tile server such as http://server/tiles/{z}/{x}/{y}.png If so, please update your question.
Please see this Mapbox example, https://www.mapbox.com/android-sdk/examples/custom-raster/ to add in a custom Mapbox Style. Note the parameter for setStyleUrl. Open up that json file and inspect it.
mapView.setStyleUrl("https://www.mapbox.com/android-sdk/files/mapbox-raster-v8.json");
You will then need to create two JSON files. See this project (which is for iOS, but the JSON files are identical for Android, Web, and iOS.).
tile.json sample
{
"name": "geography-class",
"version": "1.0.0",
"description": "",
"type": "overlay",
"format": "png",
"minzoom": 0,
"maxzoom": 8,
"bounds": [-117.30596604, 32.78617375, -117.21820077, 32.88817706],
"scale": "1",
"profile": "mercator",
"tiles": ["http://server/tiles/{z}/{x}/{y}.png"],
"tilejson": "2.0.0",
"scheme": "xyz"
}
Mapbox Style JSON, put this in the parameter for setStyleUrl()
{
"version": 8,
"sources": {
"yourTileLayer": {
"url": "http://server/tiles/tile.json",
"type": "raster",
"tiles": [
"http://server/tiles/{z}/{x}/{y}.png"
],
"tileSize": 256
}
},
"layers": [
{
"id": "yourTileLayer",
"type": "raster",
"source": "yourTileLayer"
}
]
}

Brillo's partitioning scheme

I've just recently stumbled over Brillo on Google's source code website. On it, I've found several files with the extension bpt. These are JSON files that appear to describe partitions on devices. Here are the contents of the base file:
{
"settings": {
"disk_size": "4 GiB"
},
"partitions": [
{
"ab": true,
"label": "boot",
"size": "32 MiB",
"guid": "auto",
"type_guid": "brillo_boot"
},
{
"ab": true,
"label": "system",
"size": "512 MiB",
"guid": "auto",
"type_guid": "brillo_system"
},
{
"ab": true,
"label": "odm",
"size": "512 MiB",
"guid": "auto",
"type_guid": "brillo_odm"
},
{
"label": "misc",
"size": "1 MiB",
"type_guid": "brillo_misc"
},
{
"label": "userdata",
"grow": true,
"guid": "auto",
"type_guid": "brillo_userdata"
}
]
}
I can't find any documentation on this. Is it a new partition scheme (e.g., MBR, GPT, APM, Tegra PT, MTD's command line partition table parsing, etc.)?
JSON files with .bpt extensions are consumed by bpttool - A tool for partitioning disk images for Brillo and Android.
This is open sourced and is hosted at https://android.googlesource.com/platform/system/tools/bpt/+/master/
Partitioning directives are expressed in the .bpt JSON file.
Looking at the history of the repository (relatively new, only 4 months old). This was first introduced for Brillo and will probably end up in Android versions soon (In Nougat perhaps?). This may be a replacement for the GPT partitioning scheme or a derivative of it.

How to get birthday,location and gender from Google+ into android app [duplicate]

I am trying to get the birthday from the Google API, but the retrieved data in HWIOAuthBundle do not contain it.
I am wondering if the specified scope for google plus api in config.yml is correct or not!
If not, please give a link or the corrected scope.
google:
type: google
client_id: %client_id%
client_secret: %secret_id%
scope: "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"
paths:
email: email
profilepicture: picture
I just used and tested it using Try It. I tested it with all of the different scopes.
https://www.googleapis.com/auth/plus.login Know your basic profile
info and list of people in your circles.
https://www.googleapis.com/auth/plus.me Know who you are on Google
https://www.googleapis.com/auth/userinfo.email View your email address
https://www.googleapis.com/auth/userinfo.profile View basic
information about your account
It doesn't appear to matter you get back the birthday in all of the scopes. But what does matter is that the Users Birthday must be set to public in the Account. If it's set to anything else, your circles, only you, it's not listed. This appears to be true even when you are trying to see your own information. (Sending Me.)
Update and the year is 2018
The People api now returns the birthday of the current user
People.get However i suspect its linked to google+ so if the user hasn't filled it out you probably wont get info.
GET https://people.googleapis.com/v1/{resourceName=people/*}
Send Resournce name of people/me and birthdays personFields
{
"resourceName": "people/117200475532672775346",
"etag": "%EgQBBzcuGgwBAgMEBQYHCAkKCwwiDDQwaGhWYzc3cXJBPQ==",
"birthdays": [
{
"metadata": {
"primary": true,
"source": {
"type": "PROFILE",
"id": "117200475532672775346"
}
},
"date": {
"month": 1,
"day": 6
}
},
{
"metadata": {
"source": {
"type": "ACCOUNT",
"id": "117200475532672775346"
}
},
"date": {
"year": 1971,
"month": 1,
"day": 6
}
}
]
Normally you will only get birthdays that have public visibility. To get private birthdays you need to use the https://www.googleapis.com/auth/user.birthday.read scope. See documentation for which scopes give you which data https://developers.google.com/people/v1/how-tos/authorizing#profile-scopes.

Google reverse geocode doesn't always return a street_address

I'm making a very basic google reverse geocode call like:
http://maps.googleapis.com/maps/api/geocode/json?latlng=37.785546,-122.406551&sensor=true
... and lately (I feel this started happening recently) I'm not getting back a street address. For example, I always use to get something like this:
{
"results": [
{
"address_components": ... ,
"formatted_address": "1 Stockton St, San Francisco, CA 94102, USA",
"geometry": ...,
"types": [
"street_address"
]
},
...
Now I often don't get a street_address, but instead get something like this as the most accurate reverse geocode result:
{
"results": [
{
"address_components": ...,
"formatted_address": "4th St & Market St, San Francisco, CA 94103, USA",
"geometry": ...,
"types": [
"transit_station"
]
},
I always want the nearest street address. Does anyone know of a way to force google maps api to always return one?
Talked to Google about this. There isn't a way to specify that you want an actual street address.

Categories

Resources