Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid : Why BroadcastReceiver crashing?
    primarykey
    data
    text
    <p>I have this Broadcast receiver registered</p> <pre><code>public class NotifyAlarmBroadcast extends BroadcastReceiver{ public Context context; public static final String NOTI = "android.intent.action.MAIN"; // actually i want NOTI = "com.sumit.timekeeper.NotifyAlarm" // this too is not working // help me here please @Override public void onReceive(Context _context, Intent intent) { context = _context; Uri data = intent.getData(); String reason = intent.getStringExtra("alarm_reason"); Intent intentalarm = new Intent(NOTI, data); intentalarm.putExtra("reason", reason); context.startActivity(intentalarm); } </code></pre> <p>}</p> <p>and the manifest</p> <pre><code>&lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt; &lt;activity android:name=".TimeKeeperStartActivity" android:screenOrientation="portrait" android:label="@string/app_name"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".NotifyAlarm" android:screenOrientation="portrait" android:theme="@android:style/Theme.Dialog"&gt; &lt;intent-filter&gt; &lt;action android:name="com.sumit.timekeeper.NotifyAlarm"&gt; &lt;/action&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;receiver android:name=".NotifyAlarmBroadcast"&gt; &lt;intent-filter&gt; &lt;action android:name="com.sumit.timekeeper.NotifyAlarmBroadcast" /&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; &lt;/application&gt; </code></pre> <p>but when the line reaches context.startActivity(intentalarm); the application crashes</p> <p>may be it is where we pass first parameter to Intent, i'm not clear about please help me.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload