码迷,mamicode.com
首页 > 移动开发 > 详细

Edit the AlarmClock in AOSP with android-studio

时间:2014-10-07 18:53:23      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:android   style   blog   http   io   os   ar   java   for   

1. git the AlarmClock source code on AOSP

2. select ‘import project‘ by android-studio & we will revise this code

AlarmKlaxon.java
     L89
           //mVibrator = new Vibrator();
           mVibrator = (Vibrator)getSystemService(VIBRATOR_SERVICE);

           L207,8
      //setDataSourceFromResource(getResources(), mMediaPlayer,
      // com.android.internal.R.raw.fallbackring);
      setDataSourceFromResource(getResources(), mMediaPlayer,
       R.raw.fallbackring);
      R.raw.fallbackringとしてfallbackring.oggをファイルを保存 (可以自己隨便用個叫fallbackring.ogg的音檔放到main/res/raw下面)


  Alarms.java
    L462
      //Intent alarmChanged = new Intent(Intent.ACTION_ALARM_CHANGED);
      final String ACTION_ALARM_CHANGED = "android.intent.action.ALARM_CHANGED";
      Intent alarmChanged = new Intent(ACTION_ALARM_CHANGED);

    L512,521,538
    指定APIに対応していないAPIを呼び出そうとしている。
    Eclipseクイックフィックス
    Add target api to (メソッド名)で修正


  DigitalClock.java
    L52 追加
      private Context mContext;

    L104, 110 追加
      this.mContext = context;

    L187
  Alarms.java 同様アノテーション付与


SetAlarm.java
L116
//.findViewById(com.android.internal.R.id.content);
.findViewById(android.R.id.content);

L165
Alarms.java 同様アノテーション付与


AndroidManifest.xml
追加
要素の次

Please execute ‘adb uninstall com.android.alarmclock‘ in a shell.
と出たら素直にCMDで実行

後來還是在一些xml上面報錯,因此砍掉一些錯誤的行。暫時想不到怎改阿!!

結果build apk成功。

ref:

1. http://imax-live.blogspot.tw/2013/04/platformpackagesappsalarmclock.html

2. http://bokukoko.hatenablog.com/entry/20120825/1345895842

Edit the AlarmClock in AOSP with android-studio

标签:android   style   blog   http   io   os   ar   java   for   

原文地址:http://www.cnblogs.com/bittorrent/p/4009469.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!