您好,登錄后才能下訂單哦!
PendingIntent android.app.PendingIntent.getActivity(Context context,int requestCode,Intent intent,int flags)
源碼注釋:
Retrieve a PendingIntent that will start a new activity, like calling Context.startActivity(Intent)
. Note that the activity will be started outside of the context of an existing activity, so you must use theIntent.FLAG_ACTIVITY_NEW_TASK
launch flag in the Intent.
Parameters:
context The Context in which this PendingIntent should start the activity.
requestCode Private request code for the sender (currently not used).
intent Intent of the activity to be launched.
flags May be FLAG_ONE_SHOT
, FLAG_NO_CREATE
, FLAG_CANCEL_CURRENT
, FLAG_UPDATE_CURRENT
, or any of the flags as supported by Intent.fillIn()
to control which unspecified parts of the intent that can be supplied when the actual send happens.
Returns:
Returns an existing or new PendingIntent matching the given parameters. May return null only ifFLAG_NO_CREATE
has been supplied.
flags:
(1) android.app.PendingIntent.FLAG_UPDATE_CURRENT
如果PendingIntent已經存在,保留它并且只替換它的extra數據。
(2) android.app.PendingIntent.FLAG_CANCEL_CURRENT
如果PendingIntent已經存在,那么當前的PendingIntent會取消掉,然后產生一個新的PendingIntent。
(3) android.app.PendingIntent.FLAG_ONE_SHOT
PendingIntent只能使用一次。調用了實例方法send()之后,它會被自動cancel掉,再次調用send()方法將失敗。
(4) android.app.PendingIntent.FLAG_NO_CREATE
如果PendingIntent不存在,簡單了當返回null。
requestCode:
如果一次推送幾個通知到通知欄,且requestCode一致的話,PendingIntent里里邊的數據會被最后一個推送過來的替換掉,即:第一個推送的數據會跟第二個一樣。這點一定要注意。
微信公眾賬號資源的連接
歡迎關注公眾賬號 jszj2014215 分享android資訊和技術相關問題
http://mp.weixin.qq.com/s?__biz=MzA3NzMxODEyMQ==&mid=224348184&idx=1&sn=67b5c05163a3cc182b8e9061dde815a1#rd
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。