0

私は問題があります。AddProximityAlert でデバイスをウェイクアップさせたくない。私は受信者を持っていません(登録を解除できないため、この状況では受信できません)。この方法で意図を addProximityIntent にプッシュするだけです。

Intent myIntent = new Intent(cxt, alarmView.class);
myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);


PendingIntent proximityIntent = PendingIntent.getActivity(cxt, records.get(pos).process,myIntent, 0);
locationManager.addProximityAlert(records.get(pos).x,
                            records.get(pos).y, records.get(pos).r, // metry
                            -1, proximityIntent);

PowerManager.newWakeLock を myIntent.onCreate に挿入しようとしましたが、機能しません (アクティビティが作成されていないため、ウェイク前ですか?)。

私の携帯電話を目覚めさせるために、または他の方法でそれを行うために、私のインテントにパラメータを与えることは可能ですか?

(できればアンロックデバイスも欲しい)

4

1 に答える 1

1

アクティビティの onCreate() メソッドは次のalarmViewようになります。

@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);

    /**** Turn the screen on and show your activity ****/
    android.view.Window window = getWindow();
    window.addFlags(android.view.WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
    window.addFlags(android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
    window.setContentView(R.layout.activity_alarm_view);
    /***************************************************/

    /**** Rest of your code as it is ****/

    /*  ---------------------------- ****/

    /************************************/
}

ここでは、このアクティビティのレイアウト ファイルの名前がactivity_alarm_view.xml

于 2012-09-13T15:59:55.537 に答える