• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

I get intent error for create alarm clock

iacoposk8

Lurker
Nov 13, 2013
6
0
I would create an alarm clock, i wrote this code but return this error:

2019-02-05 10:58:13.902 2663-10077/com.google.android.gms E/ChromeSync: [Sync,SyncIntentOperation] Error handling the intent: Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.example.iacopo.alarmgroup flg=0x4000010 cmp=com.google.android.gms/.chimera.GmsIntentOperationService (has extras) }.

How can i fix it? thanks And this code doesn't create a icon af alarm in the notification panel, near the clock

Code:
public class MainActivity extends AppCompatActivity {
   @Override
   protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_main);

       Calendar cal = Calendar.getInstance();
       cal.setTimeInMillis(System.currentTimeMillis());
       cal.clear();
       cal.set(2018,1,5,10,0);

       AlarmManager alarmMgr = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
       Intent intent = new Intent(MainActivity.this, AlarmReceiver.class);
       this.startService(intent);
       PendingIntent pendingIntent = PendingIntent.getBroadcast(MainActivity.this, 0, intent, 0);
       alarmMgr.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pendingIntent);
   }
}
and the receiver

Code:
public class AlarmReceiver extends BroadcastReceiver {
   @Override
   public void onReceive(Context context, Intent intent) {
       Log.i("test","ok");
   }
}
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones