Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ti.car

Use Android Auto (Android Car) with Titanium SDK.

For Apple CarPlay visit https://github.com/hansemannn/titanium-carplay/

Requirements

  • Add this to your tiapp.xml
    <uses-sdk android:minSdkVersion="23" />
    
    <application>
    
      <meta-data android:name="com.google.android.gms.car.application" android:resource="@xml/automotive_app_desc"/>
      <meta-data android:name="com.google.android.gms.car.notification.SmallIcon" android:resource="@drawable/carIcon"/>
    
    </application>
  • create app/platform/android/res/xml/automotive_app_desc.xml
    <automotiveApp>
        <uses name="template"/>
    </automotiveApp>

Testing:

  • Download Android Auto simulators and head unit. Use Android Studio for this:

  • Attach your phone and run [android sdk folder]/extras/google/auto/desktop-head-unit --usb

Methods

  • createListTemplate({})
    • title (string)
    • type (string): "list" or "grid",
    • sections (array): Array of objects with title, items:[{text},{text}]
  • createMessageTemplate({})
    • title (string)
    • text (string)
  • createToast(String) - will display a toast message on the car display

Events

  • click

Example

List template:

var car = require("ti.car");
car.createListTemplate({
	title: "ti.car demo",
	sections: [{
		title: "List section",
		items: [{
				text: "Titanium SDK"
			},
			{
				text: "Android Auto"
			},
			{
				text: "TDemo"
			}
		]
	}]
});


car.addEventListener("click", function(ev) {
	alert(ev.index);
	car.createToast("You clicked: " + ev.index);
})

Simple message:

car.createMessageTemplate({
	title: "ti.car demo",
	text: "Hello from Titanium SDK"
})

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages