3

例では、Intent を次のように作成します。

Intent intent = new Intent(this, AlarmReceiver.class);

しかし、AlarmReceiver クラスが別のアプリにあるとします。このインテントを作成するにはどうすればよいでしょうか?

私は試してみました

new Intent("com.app.AlarmReceiver")

しかし、何も起こりません..呼び出されませんでした..

何か案が?

-- Eclipse のマニフェスト エディターを使用して追加されたブロードキャスト定義:

<receiver android:name="AlarmReceiver"></receiver>
</application>

--
関連:
他のアプリから自分のアプリを起動するにはどうすればよいですか? (ただし、この同じコードはブロードキャストでは機能しません..)

4

1 に答える 1

4

But my suppose my AlarmReceiver class is in another app, how do I create this intent?

If you wrote the other app, add an <intent-filter> with a custom action string to the other app's <receiver> element, then use an Intent with that action string.

If you did not write the other app, ask whoever wrote it what the Intent should look like.

于 2010-07-23T15:51:45.297 に答える