[問題] android adb shell指令

看板java作者 (王妃)時間15年前 (2010/10/07 17:22), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
請問如果我要用adb指令廣播去觸發intent然後傳123給模擬器 目前查到是在shell下用am broadcast intent 但請問我程式該怎麼撰寫去接收adb指令發出的廣播, 然後接收處理完,讓主程式的BroadcastReceiver接收, 並印出接收到的字串訊息。 目前會寫自訂的廣播訊息讓主程式接收 如public class mServiceReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { try { /* 取回來自背景服務所Broadcast的參數 */ Bundle bunde = intent.getExtras(); String strParam1 = bunde.getString("STR_PARAM1"); /* 將從Service裡傳來的廣播訊息顯示於TextView */ mTextView01.setText(strParam1); //Intent i = new Intent( ReceiveAP.this, mService1.class ); } catch(Exception e) { mTextView01.setText(e.toString()); e.getStackTrace(); } } } 但就卡在不曉得要怎麼撰寫從adb指令傳過來的字串相關程式碼, 請問各位前輩有人使用過adb相關廣播的指令嗎? 拜託大家了。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 219.87.71.10 ※ 編輯: cloudfly 來自: 219.87.71.10 (10/07 17:23)

10/07 18:46, , 1F
請先去google BroadcastReceiver 看一下相關文章
10/07 18:46, 1F
文章代碼(AID): #1ChP5YoU (java)