@Override
public void onNotifyData(int result, byte[] data) {
String temp = new String(data);
Log.d(TAG, "onNotifyData result-->" + result+" data="+temp);
if (mContext != null) {
Toast.makeText(mContext,"亲情通消息: "+temp, Toast.LENGTH_LONG).show();
Intent intent = new Intent();
intent.setAction("wodexiaoxi");
intent.putExtra("message",temp);
ThreeCallback.this.sendBroadcast(intent);
}
}
以上是我的代码,sendBroadcast报错,说没有定义,但是在Activity中用就好使,那么改如何修改能在service中使用
------解决方案--------------------
context.sendBroadcast(); 这样可以的,通过外部传进来的或者全局什么的context可以的activyt的context