Develop an Android Auto custom app

后端 未结 3 1644
情书的邮戳
情书的邮戳 2021-02-03 14:38

I\'m an Android developer and I\'m trying to develop a custom Android Auto app, that does a simple mirroring of the phone screen. I know that currently the API are only availabl

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-03 15:01

    Create a service like this:

    public class HelloWorldService extends CarActivityService {
    
        @Override
        public Class getCarActivity() {
            return HelloWorldAutoActivity.class;
        }
    }
    

    Then add the service to your manifest like this:

        
    
        
            
                
    
                
                
            
        
    

    Finally create a xml file called automotive_app_desc under your res folder:

    
        
        
        
    
    

    Your HelloWorldAutoActivity.class will work as your MainActivity.

提交回复
热议问题