慢慢积累:Android程序兼容性技巧

  • 安装时获取用户授权APP做某种事:<uses-permission android:name="android.permission.CAMERA" />
  • 安装时指定硬件要求: <uses-feature android:name="android.hardware.camera" android:required="true/false" />
  • 运行时发送隐式Intent之前看看这个intent是否被支持. 关键API:  intent.resolveActivity(packageManager) == null ? ;
  • 运行时确认硬件可用性:getPackageManager().hasSystemFeature(…);
  • 运行时判断API Level:  if(android.os.Build.VERSION.SDK_INT > 14) …

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.