Holo风格的开源中国Android客户端——持续更新(1)

1、图片 java

首页 android

          

登陆 app

   

2、关于登陆的几个疑问 ui

    一、Manifest文件的警告: this

<receiver android:name=".ui.BroadCast">
            <intent-filter>
                <action android:name="net.oschina.app.action.APPWIDGET_UPDATE" />
            </intent-filter>
</receiver>


警告:Exported receiver does not require permission。 spa

关于这个警告,字面意思应该是说:这是一个能够被外部访问的service,须要使用权限来限制外部访问。 code

网上查了些资料,给出的解释以下: orm

1.一、添加一句话,限制外部访问,那么天然就不须要权限了。 xml

android:exported="false"

1.二、声明权限 图片

先在<manifest>标签下加入:

<permission android:protectionLevel="normal" android:name="oem.permission.SENDMAIL"></permission>
而后在<receiver>标签下添加
android:permission="oem.permission.SENDMAIL"


二、登陆成功后发送广播的做用

2.一、登陆成功

// 发送通知广播
UIHelper.sendBroadCast(LoginDialog.this, user.getNotice());

2.二、发送广播代码

/**
 * 发送通知广播
 * 
 * @param context
 * @param notice
 */
public static void sendBroadCast(Context context, Notice notice) {
	if (!((AppContext) context.getApplicationContext()).isLogin()
			|| notice == null)
		return;
	Intent intent = new Intent("net.oschina.app.action.APPWIDGET_UPDATE");
	intent.putExtra("atmeCount", notice.getAtmeCount());
	intent.putExtra("msgCount", notice.getMsgCount());
	intent.putExtra("reviewCount", notice.getReviewCount());
	intent.putExtra("newFansCount", notice.getNewFansCount());
	context.sendBroadcast(intent);
}

是用于更新内容吗?求高人指点。

相关文章
相关标签/搜索