我做了一个简单的应用程序,当手机插入充电时会显示一些文本。但它不适用于我的 HTC One X。下面是代码,有人可以帮忙吗?
public class ChargingBroadcastReceiverActivity extends BroadcastReceiver {
@Override
public void onReceive(Context c, Intent i) {
String POWER_CONNECTED = "android.intent.action.ACTION_POWER_CONNECTED";
if (i.getAction().equals(POWER_CONNECTED))
{
Toast.makeText(c, "Thanks For the Power", Toast.LENGTH_LONG).show();
}
}
}