Not allowed to bind to service Intent

前端 未结 6 2006
时光说笑
时光说笑 2020-12-31 10:42

I write an android service of get weather, and the AndroidManifest.xml is:




        
6条回答
  •  心在旅途
    2020-12-31 11:08

    My problem was solved by David Wasser in a comment so I thought I share.

    In the Manifest you can set exported attribute to true. This makes the service accessible to other apps.

    Manifest.xml

    
    

    MyActivity.java

    Intent intent = new Intent();
    intent.setComponent(new ComponentName("jav.android.app",jav.android.app.MyUsefulService_");
    
    bindService(this,MyServiceConnection,0);
    

提交回复
热议问题