How did intent-filter change from Android 2 to Android 4?

前端 未结 1 945
清酒与你
清酒与你 2021-01-25 06:30

I have the following intent-filter in my AndroidManifest.xml which works perfectly well in Android 2.x.x and does not do anything in Android 4.x.x:

  

        
1条回答
  •  北恋
    北恋 (楼主)
    2021-01-25 06:55

    Well after some experimenting I found out that android:mimeType is not mandatory. Therefore the solution is:

      
        
        
        
        
      
    

    As a little extra I found out that an can have two ore more tags. If either match the intent is called (logical OR)

    Inside a tag all attributes must match (logical AND).

    However there is a problem with this solution: It seems there is a bug in Android 2.x and the attributes of the are not strictly treated logical AND resulting in all files being matched when the android:mimeType attribute is set. Ah well, you can't have it both ways and will go with the future if that is the case.

    0 讨论(0)
提交回复
热议问题