my code is working in app running case but the code is not working after restarting the device, the broad cast is a bootup broadcast.
public class AlarmReceiver extends BroadcastReceiver {
private ArrayList<UserVo> users;
private int userCount;
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, "alarm start", Toast.LENGTH_LONG).show();
Toast.makeText(context, "Alarm Triggered and SMS Sent", Toast.LENGTH_LONG).show();
PrintUtil.printLog("Alarm Triggered", "");
Intent intentone = new Intent(context, WelcomeActivity.class);
// intentone.setClassName("appstute.in.smarttab", "appstute.in.smarttab.welcomeScreen");
intentone.putExtra("userFlag", true);
intentone.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.getApplicationContext().startActivity(intentone);
//startActivity();
}
}
My manifest, In this manifest I have also added bootup receiver but still not visible my activity.
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>`enter code here`
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="com.truiton.mapfragment.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-feature android:name="android.permission.CALL_PHONE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"
android:persistent="true">
<receiver
android:name=".BootUpReceiver"
android:enabled="true"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver android:name=".AlarmReceiver" />
<service android:enabled="true" android:name=".Service.AlarmService" />
<service android:name=".location.LocationService" />
<service android:name=".Service.WebService" />
<activity
android:name=".welcomeScreen.WelcomeActivity"
android:noHistory="true"
android:screenOrientation="portrait"
android:alwaysRetainTaskState="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<activity android:name=".feedbackQuestions.VodaFoneFeedbackActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden">
</activity>
<activity android:name=".feedbackQuestions.StandardFeedbackFormActivity"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden"
android:screenOrientation="portrait">
</activity>
</application>