SlideShare a Scribd company logo
1 of 63
Lecture 12/13 - Maps and Speech,
Mini Lectures (AR/VR/Hardware)
CIS 195 - Android App Development
Final Project Deliverable
• Final Project Application - Due 4/28 at 11:59 PM EDT
• https://www.seas.upenn.edu/~cis195/android/project.html
• Deliverables:
– Zip Folder including all code
– Help_log.txt (-5 if not included)
– Readme.txt (-5 if not included)
• Include description of what your project is, as well as the
features (points) you chose to implement
Agenda
• Google Maps API
• Speech Recognition
• Kotlin Stats
• Non-Native Android Development
• Monetization
• Other Forms of Android
• Sensors
• VR/AR
Google Maps API
Google Maps for Android
https://developers.google.com/maps/documentation/android-sdk/intro
Before: Make sure google services is set up:
https://developers.google.com/android/guides/setup
• Make sure your emulator supports Google Play API
Step 1: Create Google Maps Activity
Step 2: Get Google Maps API
Step 1: Create Google Maps Activity
Step 2: Get Google Maps API (go into google_maps_api.xml file)
Within google_maps_api.xml….
<string name="google_maps_key"
templateMergeStrategy="preserve"
translatable="false">[YOUR KEY
HERE]</string>
In MapsActivity
override fun onMapReady(googleMap: GoogleMap) {
mMap = googleMap
// Add a marker in Sydney and move the camera
val sydney = LatLng(-34.0, 151.0)
mMap.addMarker(MarkerOptions().position(sydney).title("Marker in Sydney"))
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney))
}
Get Location: First Check for Permissions
private fun setUpMap() {
if (ActivityCompat.checkSelfPermission(this,
android.Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this,
arrayOf(android.Manifest.permission.ACCESS_FINE_LOCATION), 123)
return
}
}
The code above checks if the app has been granted the
ACCESS_FINE_LOCATIONpermission. If it hasn’t, then request it from the user.
Get Current Location
First, have your activity class extend the following:
class MapsActivity : AppCompatActivity(), OnMapReadyCallback,
GoogleMap.OnMyLocationButtonClickListener, GoogleMap.OnMyLocationClickListener
Second, call setUpMap() within onMapReady()
Third, add these lines to setUpMap:
mMap.isMyLocationEnabled = true
mMap.setOnMyLocationButtonClickListener(this);
mMap.setOnMyLocationClickListener(this);
Override the following functions
override fun onMyLocationClick(location: Location) {
Toast.makeText(this, "Current location:n" + location, Toast.LENGTH_LONG).show()
}
override fun onMyLocationButtonClick(): Boolean {
Toast.makeText(this, "MyLocation button clicked", Toast.LENGTH_SHORT).show()
// Return false so that we don't consume the event and the default behavior still occurs
// (the camera animates to the user's current position).
return false
}
Emulator Settings
Access Your Settings Here!
Override Your Current Location
Places Search
Google Places
https://developers.google.com/places/android-sdk/intro
https://developers.google.com/places/android-sdk/autocomplete
Dependency:
implementation 'com.google.android.libraries.places:places:x.x.x'
Initialize Places In Your Activity
// Initialize Places
Places.initialize(getApplicationContext(), getString(R.string.google_maps_key))
// Create a new Places client instance.
val placesClient = Places.createClient(this)
Autocomplete Fragment
<fragment android:id="@+id/search_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"
android:name="com.google.android.libraries.places.widget.AutocompleteSupportFragment"
/>
Initialize the Autocomplete Fragment
// Initialize the AutocompleteSupportFragment.
val autocompleteFragment = supportFragmentManager.findFragmentById(R.id.search_text) as
AutocompleteSupportFragment?
// Specify the types of place data to return.
autocompleteFragment!!.setPlaceFields(Arrays.asList(Place.Field.ID, Place.Field.NAME))
// Set up a PlaceSelectionListener to handle the response.
autocompleteFragment.setOnPlaceSelectedListener(object : PlaceSelectionListener {
override fun onPlaceSelected(place: Place) {
// TODO: Get info about the selected place.
Log.i("autocomplete fragment", "Place: " + place.name + ", " + place.id)
}
More Cool Things with Maps
Draw Polygons to
Represent Areas
Read more here
Styled Maps
Read more here
Heatmaps
Read more here
Speech Recognition
RecognizerIntent
https://developer.android.com/reference/android/speech/RecognizerIntent.html
Lets you use speech recognition through an Intent
Note: Doesn’t work on emulators (only on physical
Android devices)
Get the speech dialog
private fun promptSpeechInput() {
val intent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH)
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "en-US") // set language
if (intent.resolveActivity(packageManager) != null) {
startActivityForResult(intent, 10) // start activity
} else {
Toast.makeText(this, "Your Device Don't Support Speech Input", Toast.LENGTH_SHORT).show()
}
}
Get the text results
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == 10) {
if (resultCode == Activity.RESULT_OK && null != data) {
var result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS)
search_text.setText(result[0]) // set the search bar with the results
}
}
}
Other cool voice things
SpeechRecognizer → Continuously records and
transcribes from speech to text
- A bit creepy, could make a spy app
- https://developer.android.com/reference/android/speech/SpeechRecognizer
MediaRecorder → basic microphone recording
functionality
- https://developer.android.com/guide/topics/media/mediarecorder
Kotlin Facts
Interesting Kotlin Statistics
Interesting Kotlin Statistics
Interesting Kotlin Statistics
More with Kotlin?
Kotlin can be “transpiled”
to JavaScript
https://www.youtube.com/watch?v=Vur75HcfyGc
Kotlin Native
https://blog.jetbrains.com/kotlin/2017/04/kotlinnative-tech-
preview-kotlin-without-a-vm/
Non-Native Android
Development
Cordova PhoneGap and React Native
We have been working
in the “Native” world.
But what if your friend
wants to build an
Android app without
learning Kotlin?
Find new friends? Or is
there a compromise?
PhoneGap
“PhoneGap is a distribution of
Apache Cordova — coming with a
few tweaks and custom packages —
that you can use for embedding
websites in mobile apps via
WebView. In short: more than a
website, yet not a fully native mobile
app. A hybrid app compromise!”
React Native
“For a React Native-powered app is written in JS, like a PhoneGap one,
yet it doesn't just render a webview, but REAL native components
instead!”
More Info
PhoneGap: https://phonegap.com/getstarted/
React Native: https://facebook.github.io/react-native/docs/getting-started
Comparison:
https://uxplanet.org/react-native-vs-cordova-phonegap-ionic-etc-2f85d9651605
https://www.optasy.com/blog/phonegap-vs-react-native-which-platform-choose-building-your-mobile-app-and-why
Other options: Ionic, Cordova, Xamarin
Monetization
Monetization/Publishing an App
- Why do people make mobile
apps?
- To improve their mobile development skills
- Create useful products for the public
- Make $$$
- First, we monetize our apps
- Then, we release them publicly
on the Google Play Store
Monetization Options/Strategy
1. Advertising
2. In-App
Purchases
3. Subscriptions
4. Paid apps
5. E-commerce
*We use the Google Play Developer Console to keep track of purchases
Inserting Ads in Android Studio
Publishing on the Google Play Store
1. Make a Google Play Developer
Account ($25 fee and no ID
check)
2. Create an app listing: upload a
title, description, app icon, app
screenshots, etc.
3. Upload APK (!!!)
4. Wait for approval (very simple
for Android apps)
Pushing Out Updates
1. Make sure to keep track of your
changes and back up to git
2. Update version code in
AndroidManifest.xml
3. Insert API keys if not already
included
4. Generate a new, signed APK
5. Upload new APK to the Google
Play Store and include a
description detailing new
features/bug fixes
Other Forms of Android
Android TV
Android TV
Read more here
Android Auto
Android Things
Showcase: https://androidthings.withgoogle.com/#!/
Wearables
Ambient mode vs. Always on
Round vs. Square screen
Specialized UI Layouts
Sensors
A whole bunch of options
Easy to set up
class SensorActivity : Activity(), SensorEventListener {
private lateinit var sensorManager: SensorManager
private var mLight: Sensor? = null
public override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.main)
sensorManager = getSystemService(Context.SENSOR_SERVICE) as SensorManager
mLight = sensorManager.getDefaultSensor(Sensor.TYPE_LIGHT)
}
Override
override fun onAccuracyChanged(sensor: Sensor, accuracy: Int) {
// Do something here if sensor accuracy changes.
}
override fun onSensorChanged(event: SensorEvent) {
// The light sensor returns a single value. Many sensors return 3 values,
one for each axis.
val lux = event.values[0]
// Do something with this sensor value.
}
Override
override fun onResume() {
super.onResume()
mLight?.also { light ->
sensorManager.registerListener(this, light,
SensorManager.SENSOR_DELAY_NORMAL)
}
}
override fun onPause() {
super.onPause()
sensorManager.unregisterListener(this)
}
}
VR/AR Resources
VR / AR
Easier than you might think!
https://developers.google.com/ar/develop/java/quickstart
Android Tutorial:
https://www.raywenderlich.com/408-getting-started-with-arcore-
with-kotlin
https://www.youtube.com/watch?v=zs5RIfiUB8I <- ARKit in 30 min!

More Related Content

Similar to Lecture 12 - Maps, AR_VR_aaaaHardware.pptx

Whats New in Android
Whats New in AndroidWhats New in Android
Whats New in Androiddonnfelker
 
Getting started with android dev and test perspective
Getting started with android   dev and test perspectiveGetting started with android   dev and test perspective
Getting started with android dev and test perspectiveGunjan Kumar
 
Exploring Google (Cloud) APIs with Python & JavaScript
Exploring Google (Cloud) APIs with Python & JavaScriptExploring Google (Cloud) APIs with Python & JavaScript
Exploring Google (Cloud) APIs with Python & JavaScriptwesley chun
 
Build your own remote control. Droidcon greece 2016
Build your own remote control. Droidcon greece 2016Build your own remote control. Droidcon greece 2016
Build your own remote control. Droidcon greece 2016Jesus Gumiel
 
Playing with parse.com
Playing with parse.comPlaying with parse.com
Playing with parse.comJUG Genova
 
Holland9 Android Workshop Hogeschool Rotterdam
Holland9 Android Workshop Hogeschool RotterdamHolland9 Android Workshop Hogeschool Rotterdam
Holland9 Android Workshop Hogeschool RotterdamJ B
 
The Glass Class - Tutorial 3 - Android and GDK
The Glass Class - Tutorial 3 - Android and GDKThe Glass Class - Tutorial 3 - Android and GDK
The Glass Class - Tutorial 3 - Android and GDKGun Lee
 
Building Cross-Platform Mobile Apps
Building Cross-Platform Mobile AppsBuilding Cross-Platform Mobile Apps
Building Cross-Platform Mobile AppsTroy Miles
 
Android studio
Android studioAndroid studio
Android studioAndri Yabu
 
Appium Overview - by Daniel Puterman
Appium Overview - by Daniel PutermanAppium Overview - by Daniel Puterman
Appium Overview - by Daniel PutermanApplitools
 
Jose l ugia 6 wunderkinder, momenta
Jose l ugia  6 wunderkinder, momentaJose l ugia  6 wunderkinder, momenta
Jose l ugia 6 wunderkinder, momentaapps4allru
 
GDG Oslo: Hidden Android features
GDG Oslo: Hidden Android featuresGDG Oslo: Hidden Android features
GDG Oslo: Hidden Android featuresKonstantin Loginov
 
DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.JooinK
 
DIY- computer vision with GWT
DIY- computer vision with GWTDIY- computer vision with GWT
DIY- computer vision with GWTFrancesca Tosi
 
From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)Bramus Van Damme
 
201507_NeoHsu_Portfolio
201507_NeoHsu_Portfolio201507_NeoHsu_Portfolio
201507_NeoHsu_PortfolioNeo Hsu
 
Build your cross-platform service in a week with App Engine
Build your cross-platform service in a week with App EngineBuild your cross-platform service in a week with App Engine
Build your cross-platform service in a week with App EngineJl_Ugia
 
Telerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT ConferenceTelerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT ConferenceJen Looper
 
Desenvolvendo para Android com componentes Open Source
Desenvolvendo para Android com componentes Open SourceDesenvolvendo para Android com componentes Open Source
Desenvolvendo para Android com componentes Open SourceAdriel Café
 
Mobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on Android
Mobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on AndroidMobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on Android
Mobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on AndroidAlberto Ruibal
 

Similar to Lecture 12 - Maps, AR_VR_aaaaHardware.pptx (20)

Whats New in Android
Whats New in AndroidWhats New in Android
Whats New in Android
 
Getting started with android dev and test perspective
Getting started with android   dev and test perspectiveGetting started with android   dev and test perspective
Getting started with android dev and test perspective
 
Exploring Google (Cloud) APIs with Python & JavaScript
Exploring Google (Cloud) APIs with Python & JavaScriptExploring Google (Cloud) APIs with Python & JavaScript
Exploring Google (Cloud) APIs with Python & JavaScript
 
Build your own remote control. Droidcon greece 2016
Build your own remote control. Droidcon greece 2016Build your own remote control. Droidcon greece 2016
Build your own remote control. Droidcon greece 2016
 
Playing with parse.com
Playing with parse.comPlaying with parse.com
Playing with parse.com
 
Holland9 Android Workshop Hogeschool Rotterdam
Holland9 Android Workshop Hogeschool RotterdamHolland9 Android Workshop Hogeschool Rotterdam
Holland9 Android Workshop Hogeschool Rotterdam
 
The Glass Class - Tutorial 3 - Android and GDK
The Glass Class - Tutorial 3 - Android and GDKThe Glass Class - Tutorial 3 - Android and GDK
The Glass Class - Tutorial 3 - Android and GDK
 
Building Cross-Platform Mobile Apps
Building Cross-Platform Mobile AppsBuilding Cross-Platform Mobile Apps
Building Cross-Platform Mobile Apps
 
Android studio
Android studioAndroid studio
Android studio
 
Appium Overview - by Daniel Puterman
Appium Overview - by Daniel PutermanAppium Overview - by Daniel Puterman
Appium Overview - by Daniel Puterman
 
Jose l ugia 6 wunderkinder, momenta
Jose l ugia  6 wunderkinder, momentaJose l ugia  6 wunderkinder, momenta
Jose l ugia 6 wunderkinder, momenta
 
GDG Oslo: Hidden Android features
GDG Oslo: Hidden Android featuresGDG Oslo: Hidden Android features
GDG Oslo: Hidden Android features
 
DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.DIY: Computer Vision with GWT.
DIY: Computer Vision with GWT.
 
DIY- computer vision with GWT
DIY- computer vision with GWTDIY- computer vision with GWT
DIY- computer vision with GWT
 
From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)From Idea to App (or “How we roll at Small Town Heroes”)
From Idea to App (or “How we roll at Small Town Heroes”)
 
201507_NeoHsu_Portfolio
201507_NeoHsu_Portfolio201507_NeoHsu_Portfolio
201507_NeoHsu_Portfolio
 
Build your cross-platform service in a week with App Engine
Build your cross-platform service in a week with App EngineBuild your cross-platform service in a week with App Engine
Build your cross-platform service in a week with App Engine
 
Telerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT ConferenceTelerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT Conference
 
Desenvolvendo para Android com componentes Open Source
Desenvolvendo para Android com componentes Open SourceDesenvolvendo para Android com componentes Open Source
Desenvolvendo para Android com componentes Open Source
 
Mobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on Android
Mobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on AndroidMobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on Android
Mobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on Android
 

Recently uploaded

Welcome to GFDL for Take Your Child To Work Day
Welcome to GFDL for Take Your Child To Work DayWelcome to GFDL for Take Your Child To Work Day
Welcome to GFDL for Take Your Child To Work DayZachary Labe
 
Call Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCR
Call Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCRCall Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCR
Call Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCRlizamodels9
 
Forest laws, Indian forest laws, why they are important
Forest laws, Indian forest laws, why they are importantForest laws, Indian forest laws, why they are important
Forest laws, Indian forest laws, why they are importantadityabhardwaj282
 
Evidences of Evolution General Biology 2
Evidences of Evolution General Biology 2Evidences of Evolution General Biology 2
Evidences of Evolution General Biology 2John Carlo Rollon
 
Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...Nistarini College, Purulia (W.B) India
 
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.aasikanpl
 
Harmful and Useful Microorganisms Presentation
Harmful and Useful Microorganisms PresentationHarmful and Useful Microorganisms Presentation
Harmful and Useful Microorganisms Presentationtahreemzahra82
 
Gas_Laws_powerpoint_notes.ppt for grade 10
Gas_Laws_powerpoint_notes.ppt for grade 10Gas_Laws_powerpoint_notes.ppt for grade 10
Gas_Laws_powerpoint_notes.ppt for grade 10ROLANARIBATO3
 
Microphone- characteristics,carbon microphone, dynamic microphone.pptx
Microphone- characteristics,carbon microphone, dynamic microphone.pptxMicrophone- characteristics,carbon microphone, dynamic microphone.pptx
Microphone- characteristics,carbon microphone, dynamic microphone.pptxpriyankatabhane
 
Transposable elements in prokaryotes.ppt
Transposable elements in prokaryotes.pptTransposable elements in prokaryotes.ppt
Transposable elements in prokaryotes.pptArshadWarsi13
 
Speech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptxSpeech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptxpriyankatabhane
 
Module 4: Mendelian Genetics and Punnett Square
Module 4:  Mendelian Genetics and Punnett SquareModule 4:  Mendelian Genetics and Punnett Square
Module 4: Mendelian Genetics and Punnett SquareIsiahStephanRadaza
 
Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...
Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...
Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...lizamodels9
 
Dashanga agada a formulation of Agada tantra dealt in 3 Rd year bams agada tanta
Dashanga agada a formulation of Agada tantra dealt in 3 Rd year bams agada tantaDashanga agada a formulation of Agada tantra dealt in 3 Rd year bams agada tanta
Dashanga agada a formulation of Agada tantra dealt in 3 Rd year bams agada tantaPraksha3
 
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptxLIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptxmalonesandreagweneth
 
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.PraveenaKalaiselvan1
 
‏‏VIRUS - 123455555555555555555555555555555555555555
‏‏VIRUS -  123455555555555555555555555555555555555555‏‏VIRUS -  123455555555555555555555555555555555555555
‏‏VIRUS - 123455555555555555555555555555555555555555kikilily0909
 
Neurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 trNeurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 trssuser06f238
 

Recently uploaded (20)

Welcome to GFDL for Take Your Child To Work Day
Welcome to GFDL for Take Your Child To Work DayWelcome to GFDL for Take Your Child To Work Day
Welcome to GFDL for Take Your Child To Work Day
 
Hot Sexy call girls in Moti Nagar,🔝 9953056974 🔝 escort Service
Hot Sexy call girls in  Moti Nagar,🔝 9953056974 🔝 escort ServiceHot Sexy call girls in  Moti Nagar,🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Moti Nagar,🔝 9953056974 🔝 escort Service
 
Call Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCR
Call Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCRCall Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCR
Call Girls In Nihal Vihar Delhi ❤️8860477959 Looking Escorts In 24/7 Delhi NCR
 
Forest laws, Indian forest laws, why they are important
Forest laws, Indian forest laws, why they are importantForest laws, Indian forest laws, why they are important
Forest laws, Indian forest laws, why they are important
 
Evidences of Evolution General Biology 2
Evidences of Evolution General Biology 2Evidences of Evolution General Biology 2
Evidences of Evolution General Biology 2
 
Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...Bentham & Hooker's Classification. along with the merits and demerits of the ...
Bentham & Hooker's Classification. along with the merits and demerits of the ...
 
Engler and Prantl system of classification in plant taxonomy
Engler and Prantl system of classification in plant taxonomyEngler and Prantl system of classification in plant taxonomy
Engler and Prantl system of classification in plant taxonomy
 
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Mayapuri Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
 
Harmful and Useful Microorganisms Presentation
Harmful and Useful Microorganisms PresentationHarmful and Useful Microorganisms Presentation
Harmful and Useful Microorganisms Presentation
 
Gas_Laws_powerpoint_notes.ppt for grade 10
Gas_Laws_powerpoint_notes.ppt for grade 10Gas_Laws_powerpoint_notes.ppt for grade 10
Gas_Laws_powerpoint_notes.ppt for grade 10
 
Microphone- characteristics,carbon microphone, dynamic microphone.pptx
Microphone- characteristics,carbon microphone, dynamic microphone.pptxMicrophone- characteristics,carbon microphone, dynamic microphone.pptx
Microphone- characteristics,carbon microphone, dynamic microphone.pptx
 
Transposable elements in prokaryotes.ppt
Transposable elements in prokaryotes.pptTransposable elements in prokaryotes.ppt
Transposable elements in prokaryotes.ppt
 
Speech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptxSpeech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptx
 
Module 4: Mendelian Genetics and Punnett Square
Module 4:  Mendelian Genetics and Punnett SquareModule 4:  Mendelian Genetics and Punnett Square
Module 4: Mendelian Genetics and Punnett Square
 
Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...
Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...
Best Call Girls In Sector 29 Gurgaon❤️8860477959 EscorTs Service In 24/7 Delh...
 
Dashanga agada a formulation of Agada tantra dealt in 3 Rd year bams agada tanta
Dashanga agada a formulation of Agada tantra dealt in 3 Rd year bams agada tantaDashanga agada a formulation of Agada tantra dealt in 3 Rd year bams agada tanta
Dashanga agada a formulation of Agada tantra dealt in 3 Rd year bams agada tanta
 
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptxLIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
 
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
 
‏‏VIRUS - 123455555555555555555555555555555555555555
‏‏VIRUS -  123455555555555555555555555555555555555555‏‏VIRUS -  123455555555555555555555555555555555555555
‏‏VIRUS - 123455555555555555555555555555555555555555
 
Neurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 trNeurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 tr
 

Lecture 12 - Maps, AR_VR_aaaaHardware.pptx

  • 1. Lecture 12/13 - Maps and Speech, Mini Lectures (AR/VR/Hardware) CIS 195 - Android App Development
  • 2. Final Project Deliverable • Final Project Application - Due 4/28 at 11:59 PM EDT • https://www.seas.upenn.edu/~cis195/android/project.html • Deliverables: – Zip Folder including all code – Help_log.txt (-5 if not included) – Readme.txt (-5 if not included) • Include description of what your project is, as well as the features (points) you chose to implement
  • 3. Agenda • Google Maps API • Speech Recognition • Kotlin Stats • Non-Native Android Development • Monetization • Other Forms of Android • Sensors • VR/AR
  • 5. Google Maps for Android https://developers.google.com/maps/documentation/android-sdk/intro Before: Make sure google services is set up: https://developers.google.com/android/guides/setup • Make sure your emulator supports Google Play API Step 1: Create Google Maps Activity Step 2: Get Google Maps API
  • 6. Step 1: Create Google Maps Activity
  • 7. Step 2: Get Google Maps API (go into google_maps_api.xml file)
  • 8.
  • 10. In MapsActivity override fun onMapReady(googleMap: GoogleMap) { mMap = googleMap // Add a marker in Sydney and move the camera val sydney = LatLng(-34.0, 151.0) mMap.addMarker(MarkerOptions().position(sydney).title("Marker in Sydney")) mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney)) }
  • 11.
  • 12. Get Location: First Check for Permissions private fun setUpMap() { if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, arrayOf(android.Manifest.permission.ACCESS_FINE_LOCATION), 123) return } } The code above checks if the app has been granted the ACCESS_FINE_LOCATIONpermission. If it hasn’t, then request it from the user.
  • 13. Get Current Location First, have your activity class extend the following: class MapsActivity : AppCompatActivity(), OnMapReadyCallback, GoogleMap.OnMyLocationButtonClickListener, GoogleMap.OnMyLocationClickListener Second, call setUpMap() within onMapReady() Third, add these lines to setUpMap: mMap.isMyLocationEnabled = true mMap.setOnMyLocationButtonClickListener(this); mMap.setOnMyLocationClickListener(this);
  • 14. Override the following functions override fun onMyLocationClick(location: Location) { Toast.makeText(this, "Current location:n" + location, Toast.LENGTH_LONG).show() } override fun onMyLocationButtonClick(): Boolean { Toast.makeText(this, "MyLocation button clicked", Toast.LENGTH_SHORT).show() // Return false so that we don't consume the event and the default behavior still occurs // (the camera animates to the user's current position). return false }
  • 15.
  • 21. Initialize Places In Your Activity // Initialize Places Places.initialize(getApplicationContext(), getString(R.string.google_maps_key)) // Create a new Places client instance. val placesClient = Places.createClient(this)
  • 23. Initialize the Autocomplete Fragment // Initialize the AutocompleteSupportFragment. val autocompleteFragment = supportFragmentManager.findFragmentById(R.id.search_text) as AutocompleteSupportFragment? // Specify the types of place data to return. autocompleteFragment!!.setPlaceFields(Arrays.asList(Place.Field.ID, Place.Field.NAME)) // Set up a PlaceSelectionListener to handle the response. autocompleteFragment.setOnPlaceSelectedListener(object : PlaceSelectionListener { override fun onPlaceSelected(place: Place) { // TODO: Get info about the selected place. Log.i("autocomplete fragment", "Place: " + place.name + ", " + place.id) }
  • 24. More Cool Things with Maps
  • 25. Draw Polygons to Represent Areas Read more here
  • 29. RecognizerIntent https://developer.android.com/reference/android/speech/RecognizerIntent.html Lets you use speech recognition through an Intent Note: Doesn’t work on emulators (only on physical Android devices)
  • 30. Get the speech dialog private fun promptSpeechInput() { val intent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH) intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "en-US") // set language if (intent.resolveActivity(packageManager) != null) { startActivityForResult(intent, 10) // start activity } else { Toast.makeText(this, "Your Device Don't Support Speech Input", Toast.LENGTH_SHORT).show() } }
  • 31. Get the text results override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) if (requestCode == 10) { if (resultCode == Activity.RESULT_OK && null != data) { var result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS) search_text.setText(result[0]) // set the search bar with the results } } }
  • 32.
  • 34. SpeechRecognizer → Continuously records and transcribes from speech to text - A bit creepy, could make a spy app - https://developer.android.com/reference/android/speech/SpeechRecognizer MediaRecorder → basic microphone recording functionality - https://developer.android.com/guide/topics/media/mediarecorder
  • 39. More with Kotlin? Kotlin can be “transpiled” to JavaScript https://www.youtube.com/watch?v=Vur75HcfyGc Kotlin Native https://blog.jetbrains.com/kotlin/2017/04/kotlinnative-tech- preview-kotlin-without-a-vm/
  • 41. Cordova PhoneGap and React Native We have been working in the “Native” world. But what if your friend wants to build an Android app without learning Kotlin? Find new friends? Or is there a compromise?
  • 42. PhoneGap “PhoneGap is a distribution of Apache Cordova — coming with a few tweaks and custom packages — that you can use for embedding websites in mobile apps via WebView. In short: more than a website, yet not a fully native mobile app. A hybrid app compromise!”
  • 43. React Native “For a React Native-powered app is written in JS, like a PhoneGap one, yet it doesn't just render a webview, but REAL native components instead!”
  • 44. More Info PhoneGap: https://phonegap.com/getstarted/ React Native: https://facebook.github.io/react-native/docs/getting-started Comparison: https://uxplanet.org/react-native-vs-cordova-phonegap-ionic-etc-2f85d9651605 https://www.optasy.com/blog/phonegap-vs-react-native-which-platform-choose-building-your-mobile-app-and-why Other options: Ionic, Cordova, Xamarin
  • 46. Monetization/Publishing an App - Why do people make mobile apps? - To improve their mobile development skills - Create useful products for the public - Make $$$ - First, we monetize our apps - Then, we release them publicly on the Google Play Store
  • 47. Monetization Options/Strategy 1. Advertising 2. In-App Purchases 3. Subscriptions 4. Paid apps 5. E-commerce *We use the Google Play Developer Console to keep track of purchases
  • 48. Inserting Ads in Android Studio
  • 49. Publishing on the Google Play Store 1. Make a Google Play Developer Account ($25 fee and no ID check) 2. Create an app listing: upload a title, description, app icon, app screenshots, etc. 3. Upload APK (!!!) 4. Wait for approval (very simple for Android apps)
  • 50. Pushing Out Updates 1. Make sure to keep track of your changes and back up to git 2. Update version code in AndroidManifest.xml 3. Insert API keys if not already included 4. Generate a new, signed APK 5. Upload new APK to the Google Play Store and include a description detailing new features/bug fixes
  • 51. Other Forms of Android
  • 56. Wearables Ambient mode vs. Always on Round vs. Square screen Specialized UI Layouts
  • 58. A whole bunch of options
  • 59. Easy to set up class SensorActivity : Activity(), SensorEventListener { private lateinit var sensorManager: SensorManager private var mLight: Sensor? = null public override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.main) sensorManager = getSystemService(Context.SENSOR_SERVICE) as SensorManager mLight = sensorManager.getDefaultSensor(Sensor.TYPE_LIGHT) }
  • 60. Override override fun onAccuracyChanged(sensor: Sensor, accuracy: Int) { // Do something here if sensor accuracy changes. } override fun onSensorChanged(event: SensorEvent) { // The light sensor returns a single value. Many sensors return 3 values, one for each axis. val lux = event.values[0] // Do something with this sensor value. }
  • 61. Override override fun onResume() { super.onResume() mLight?.also { light -> sensorManager.registerListener(this, light, SensorManager.SENSOR_DELAY_NORMAL) } } override fun onPause() { super.onPause() sensorManager.unregisterListener(this) } }
  • 63. VR / AR Easier than you might think! https://developers.google.com/ar/develop/java/quickstart Android Tutorial: https://www.raywenderlich.com/408-getting-started-with-arcore- with-kotlin https://www.youtube.com/watch?v=zs5RIfiUB8I <- ARKit in 30 min!

Editor's Notes

  1. Introduce the topic. Talk about motivations behind making Android apps and go through the very basic steps of monetizing apps and releasing them on the Google Play Store
  2. Go over the 5 monetization options and talk about the strategy behind using them. Give real world examples as well (i.e. Soundboards, games, Netflix-types apps, utility apps, stores)
  3. Show how one can include ads in their apps. Basically, AdMob gives black box methods that you can insert into your app. You can configure all the properties of these ads through the AdMob and Google Analytics dashboards.
  4. Here, we’ll talk a lot about exporting the APK (other stuff we’ll gloss over because they’re pretty self-explanatory). For #2, we’ll talk about how a strong description and screenshots help attract more users (also SEO-type stuff with AppAnnie)
  5. Pretty standard stuff, I’ll talk about hiding API keys if code is on a public repo (i.e. for PennMobile and other open source projects)