On touch map android

On touch map android

TouchMapper is an Android App lets you map gamepad input to touch events in the screen without needing to root the device. It is inteded to be used in Android TV where you don’t have a touch screen and you might want to play games that only support touch events as input. It’s licensed under the terms of the GNU General Public License, version 3 (GPLv3).

Other reason to use it in Android TV is because in order to make it work without rooting the device you’ll need to keep a computer connected to the device through ADB during the time you are using the touch mapper, and the most comfortable way to do that would be to run ADB through WIFI otherwise you’ll need to keep an usb connected to the device at all times.

In order to make it a bit easier, a desktop application is available that automates all process needed to run the adb commands. You can find it here: Touch Mapper Launcher

Below you can find all available information for regular users and developers that might want to play with the code:

This software is completely experimental, meaning you shouldn’t be surprised if it suddenly stops working and you need to restart it or whatever other issues that might show up.

About

TouchMapper is an Android App that lets you map gamepad input to touch events in the screen without needing to root the device. It is inteded to be used in Android TV where you don’t have a touch screen and you might want to play games that only support touch events as input.

Источник

On touch map android

TouchMapper is an Android App lets you map gamepad input to touch events in the screen without needing to root the device. It is inteded to be used in Android TV where you don’t have a touch screen and you might want to play games that only support touch events as input. It’s licensed under the terms of the GNU General Public License, version 3 (GPLv3).

Other reason to use it in Android TV is because in order to make it work without rooting the device you’ll need to keep a computer connected to the device through ADB during the time you are using the touch mapper, and the most comfortable way to do that would be to run ADB through WIFI otherwise you’ll need to keep an usb connected to the device at all times.

In order to make it a bit easier, a desktop application is available that automates all process needed to run the adb commands. You can find it here: Touch Mapper Launcher

Читайте также:  Grand theft auto для андроид с модами

Below you can find all available information for regular users and developers that might want to play with the code:

This software is completely experimental, meaning you shouldn’t be surprised if it suddenly stops working and you need to restart it or whatever other issues that might show up.

About

TouchMapper is an Android App that lets you map gamepad input to touch events in the screen without needing to root the device. It is inteded to be used in Android TV where you don’t have a touch screen and you might want to play games that only support touch events as input.

Источник

Google MAPs API в android или как работать с картами быстрее

Принцип работы Google MAPs API

Вся документация для работы с картами приведена на (логично) официальном сайте google maps api. Сегодня я рассматриваю только Directions API (документация). Для того что бы получить какую-либо информацию от большого числа, вам необходимо сделать запрос. Ответ прийдет в формате JSON.

Общий вид запроса:

Пример: https://maps.googleapis.com/maps/api/directions/json?origin=55.754724,%2037.621380&destination=55.728466,%2037.604155&key=»Your MAPs API key»

В качестве ответа нам (ожидаемо) пришел JSON с большим набором разных точек с координатами и названиями этих мест.

А как вообще работать с этой страшной штукой?

Если вы только начинаете работать с Android, то советую вам почитать про такую замечательную библиотеку Retrofit, которая превращает работу с запросами в код из 2 строк. Рассматривать сейчас я её не буду.

Но я сегодня хочу рассмотреть пример использования библиотеки Java Client for Google Maps Services. Библиотека как по мне замечательная, освобождает от необходимости писать (пусть даже очень короткие) запросы вручную и отлично подходит в случаях когда нужно писать очень быстро, как например на хакатоне. Я хочу показать живой пример использования данной библиотеки на примере работы с Directions API.

Подключение библиотеки

Для начала нам потребуется получить ключ для нашего приложения. Топаем на оф. сайт, находим сверху кнопку «получить ключ», создаем новый проект, нажимаем далее и готово!
UPD: теперь бесплатно получить нельзя. С лета 2018 года Google обновили план и необходимо ввести данные своей карты для получения 200$ для запросов каждый месяц бесплатно. Этого должно хватать, но конечно тенденция не радует.

Firebase
Для правильной работы приложения нам необходимо получить файл google-service.json. Идем на firebase выбираем наш проект и добавляем его. Далее нам нужно выбрать Android проект, ввести название пакета, регистрируем приложение. Скачиваем файл и перетаскиваем в папку app. К слову её не будет видно в дереве проекта, для этого надо в Android Studio поменять отображение с Android на Project или залезть в наш проект через файловый менеджер. Далее следуем инструкциям где какой код писать.

Включаем в консоли
Так же нам необходимо включить Directions API (или любую другую необходимую вам API) в консоли, для этого идем сюда, выбираем наше приложение и включаем Directions API.

Gradle
В Gradle файлы так же необходимо добавить еще пару строк. В итоге новые строки выглядят вот так:

Обязательно проверяйте, актуальная ли это сейчас версия!

Читайте также:  Android tv box usb gamepad

Встраиваем карту в приложение

Google map в андроид реализовывается как фрагмент (или как MapView, но об этом в другой раз, нам сейчас особой разницы нет). Просто встраиваем его в наш layout. В нашем классе, который работает с картой, необходимо найти эту карту и заимплементить интерфейс.

Код для фрагмента выглядит вот так. Я буду работать с MainActivity, соответственно если вы используете другой класс вам необходимо поменять контекст.

Отлично, фрагмент встроили, Android Studio на нас не ругается, едем дальше. Переходим в MainActivity.class и имплементим интерфейс OnMapReadyCallback.

В onCreate пишем

Так же идем в Manifests и прописываем вот такие штуки внутри тэга application

Где вместо @string/google_maps_key должен подставиться ваш ключ для карт, который мы получили ранее. Соответственно вам нужно создать нужный ресурс в файле string.

Пишем всякие интересности

Отлично, карта у нас есть, давайте наконец напишем хоть что-нибудь интересное. Пусть нашей целью будет нарисовать маршрут по Москве через несколько точек:

  • Гум (55.754724, 37.621380)
  • Большой театр (55.760133, 37.618697)
  • Патриаршие пруды (55.764753, 37.591313)
  • Парк культуры (55.728466, 37.604155)

Кладу все наши места в List и делаю это как глобальную переменную.

Для начала создадим по маркеру на каждое место. Маркер это просто объект, которому передаются координаты, а затем они накладываются на карту. Код:

Далее мы пишем вот такой код все в том же методе onMapReady

При запуске приложения мы получили вот такую картину:

Хм, Москва, конечно, весьма запутанная, но не настолько же. Почему же такой странный маршрут нам вернул Google? Потому что он построил маршрут для автомобилей, который идет по умолчанию, но мы можем это изменить. Чтобы построить маршрут для пешеходов, меняем код на:

Теперь наш маршрут выглядит вот так

Существует еще множество настроек, о всех них можно прочитать в документации. Просто мы все параметры будем добавлять не в сырой запрос, а в код, поскольку методы библиотеки имеют те же названия что и просто в запросах.

Источник

Launch Yandex.Maps Android app

This section applies to the Yandex.Maps mobile app, version 4.0 or higher.

You can launch mobile Yandex.Maps for Android from a Java app or browser page. Use the yandexmaps URL scheme to launch the app. Yandex.Maps can run the following actions on launch:

Support for geo scheme section shows how to open the map using a different URI scheme. With this method, the user can choose which app to open.

Open map

You can display the map using the following URL format:

Map center coordinates (longitude, latitude).

Map zoom. An integer from 1 to 18, where 1 is the least detailed map zoom (whole world), and 18 is the highest zoom possible.

Viewport. Longitudinal and latitudinal size of the viewport in degrees, comma-separated. For example, to set a viewport of 10.5 degrees, specify: spn=10.5, 10.5 .

The viewport center is set using the ll parameter (map center).

If z (zoom) is already set, then spn is ignored.

Map type and traffic information.

Type of map: map (Map), sat (Satellite), skl (Hybrid), pmap (Public Map).

Show road traffic: trf (\»traffic\» layer). You can enable the traffic layer only, or combine it with some map type. In this case, the parameter values are comma-separated. For example: l=map,trf .

Parameter Data type Description

Map center coordinates (longitude, latitude).

Map zoom. An integer from 1 to 18, where 1 is the least detailed map zoom (whole world), and 18 is the highest zoom possible.

Viewport. Longitudinal and latitudinal size of the viewport in degrees, comma-separated. For example, to set a viewport of 10.5 degrees, specify: spn=10.5, 10.5 .

The viewport center is set using the ll parameter (map center).

If z (zoom) is already set, then spn is ignored.

Map type and traffic information.

Type of map: map (Map), sat (Satellite), skl (Hybrid), pmap (Public Map).

Show road traffic: trf (\»traffic\» layer). You can enable the traffic layer only, or combine it with some map type. In this case, the parameter values are comma-separated. For example: l=map,trf .

Источник

Launch Yandex.Maps Android app

This section applies to the Yandex.Maps mobile app, version 4.0 or higher.

You can launch mobile Yandex.Maps for Android from a Java app or browser page. Use the yandexmaps URL scheme to launch the app. Yandex.Maps can run the following actions on launch:

Support for geo scheme section shows how to open the map using a different URI scheme. With this method, the user can choose which app to open.

Open map

You can display the map using the following URL format:

Parameter Data type Description

Map center coordinates (longitude, latitude).

Map zoom. An integer from 1 to 18, where 1 is the least detailed map zoom (whole world), and 18 is the highest zoom possible.

Viewport. Longitudinal and latitudinal size of the viewport in degrees, comma-separated. For example, to set a viewport of 10.5 degrees, specify: spn=10.5, 10.5 .

The viewport center is set using the ll parameter (map center).

If z (zoom) is already set, then spn is ignored.

Map type and traffic information.

Type of map: map (Map), sat (Satellite), skl (Hybrid), pmap (Public Map).

Show road traffic: trf (\»traffic\» layer). You can enable the traffic layer only, or combine it with some map type. In this case, the parameter values are comma-separated. For example: l=map,trf .

Parameter Data type Description

Map center coordinates (longitude, latitude).

Map zoom. An integer from 1 to 18, where 1 is the least detailed map zoom (whole world), and 18 is the highest zoom possible.

Viewport. Longitudinal and latitudinal size of the viewport in degrees, comma-separated. For example, to set a viewport of 10.5 degrees, specify: spn=10.5, 10.5 .

The viewport center is set using the ll parameter (map center).

If z (zoom) is already set, then spn is ignored.

Map type and traffic information.

Type of map: map (Map), sat (Satellite), skl (Hybrid), pmap (Public Map).

Show road traffic: trf (\»traffic\» layer). You can enable the traffic layer only, or combine it with some map type. In this case, the parameter values are comma-separated. For example: l=map,trf .

Источник

Читайте также:  Android detect device location
Оцените статью
Parameter Data type Description