我正在制作一个应用程序,我希望在其中停止广播接收器onTleto提供程序类的方法。
答案 0 :(得分:0)
尝试以下代码: -
PackageManager pm = Re_editActivity.this.getPackageManager();
ComponentName componentName = new ComponentName(currentActivity.this, name_of_your_receiver.class);
pm.setComponentEnabledSetting(componentName,PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
PackageManager.DONT_KILL_APP);
Toast.makeText(getApplicationContext(), "cancelled", Toast.LENGTH_LONG).show();
了解更多信息,请参阅以下链接: -
http://www.javacodegeeks.com/2012/08/android-broadcast-receiver-enable-and.html