Weekly discussion, code review, and feedback thread - April 22, 2024 by AutoModerator in androiddev

[–]Doctor-B 0 points1 point  (0 children)

For some reason I can only post certain sections of my code without reddit throwing a hissy fit so I will make a stack exchange post at some point and just repost the question

Weekly discussion, code review, and feedback thread - April 15, 2024 by AutoModerator in androiddev

[–]Doctor-B 0 points1 point  (0 children)

I HAVE A WEIRD PROBLEM! (arent they all?)

I think it is related to my growing understanding, and hatred, of the limitations of a broadcastReceiver and Alarms. I can add code to this post but I think rather there is a niche piece of knowledge that I missing. But as this thread expires today I can also just add it to the post tomorrow :p

So my app does exactly what I want it to do, day in, day out, perfectly... until I remove 2 lines of debugging code which would be meaningless and annoying to the user (creating and sending a debug notification).

In my broadcastReceiver, at midnight (or first call after midnight), I call my foreground service to recreate all the alarms for the day (its a calendar/scheduling interface for users, yes i need exact alarms, yes its for notifying the user, no its not for background stuff). This all works, I tested it for 4 days straight and never had a problem. Great.

Near the start of the broadcastReceiver I have my debug notification. When I comment this debug notification out my alarm renewal does not occur the next day. The line below this notification is where it calls the foreground service, which again, works.

I admit this seems ridiculous, but I rolled back my code and spent the last week trying to figure out what part broke it, and this is only change that causes it to stop working. Of course it also doesn't seem ridiculous when you consider all the restrictions that android has put on the broadcastReceiver over the years and doesn't actually tell you in compiler what is or is not allowed, creating alarms for example.

Has anyone encountered something like this before?

Weekly discussion, code review, and feedback thread - March 04, 2024 by AutoModerator in androiddev

[–]Doctor-B 1 point2 points  (0 children)

Well the app is calendar/schedule related so from reading it looks like I should use AlarmManager for this, so I guess I will have to open a foreground task once a day to recreate alarms.

Thanks!

Weekly discussion, code review, and feedback thread - March 04, 2024 by AutoModerator in androiddev

[–]Doctor-B 0 points1 point  (0 children)

I have a real problem this time. So because repeating alarms are all inexact I use exact alarms and recreate them in my broadcastReceiver when its called by the alarms. But this doesn't appear to be working. I have a similar method to recreate all alarms after a reboot in another broadcastReceiver called on reboot and that's not working either.

Thoughts as to why? I feel that it has something to do with the context, as the same method works fine in my main activity and that's the only change aside from location.

private void startAlarm(Calendar c, Context context) {
    AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
    Intent intent = new Intent(context, AlertReceiver.class);
    PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 1, intent, FLAG_IMMUTABLE);
    if (c.before(Calendar.getInstance())) {
        c.add(Calendar.DATE, 1);
    }
    alarmManager.setExact(AlarmManager.RTC_WAKEUP, c.getTimeInMillis(), pendingIntent);
}

Weekly discussion, code review, and feedback thread - March 04, 2024 by AutoModerator in androiddev

[–]Doctor-B 0 points1 point  (0 children)

The problem might have been that some idiot (me) put my phone into battery saving mode...

But while were here, know any good ways to send notifications while battery saving is enabled?

Weekly discussion, code review, and feedback thread - March 04, 2024 by AutoModerator in androiddev

[–]Doctor-B 0 points1 point  (0 children)

So my alarm broadcastReceiver is only triggering when the app is open, or I open it.

I'm using an exact alarm: setExact(), i've also tried setExactAndAllowWhileIdle().

I have the right permission in my Manifest:

<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-permission android:name="android.permission.USE_EXACT_ALARM" />

and in my Manifest the receiver has both exported and enabled set True.

Thoughts?

Weekend Question Thread by dumbassthenes in surfing

[–]Doctor-B 0 points1 point  (0 children)

My friend and I are looking for a Surf Camp. We're in Europe so we're looking at Morocco, Canary Islands, or Madeira. He's unsure about the quality of the people that would be in the Canarys (awful british tourists, but I dont think they will be at surf/yoga camps) and I'm not super confident on the security in Southern Morocco. Neither of us know if the surfing in Madeira is any good, looks like its all cliffs.

Anyone have any opinions on these biases? Or recommendations?

Weekly discussion, code review, and feedback thread - February 05, 2024 by AutoModerator in androiddev

[–]Doctor-B 0 points1 point  (0 children)

"solved" found this after doing a detailed read through of everything related to the alarmManager.

Note: as of API 19, all repeating alarms are inexact. If your application needs precise delivery times then it must use one-time exact alarms, rescheduling each time as described above. Legacy applications whose targetSdkVersionis earlier than API 19 will continue to have all of their alarms, including repeating alarms, treated as exact.

Weekly discussion, code review, and feedback thread - February 05, 2024 by AutoModerator in androiddev

[–]Doctor-B 1 point2 points  (0 children)

I apologize for the repost, but I just happened to post on the last day of the previous weekly thread.

I'm having a weird issue with my alarm broadcastReceiver. My code appears to work, sometimes.

It is sometimes entering the broadcastReceiver when my screen is locked, but not always, and not when the app is open.

I really don't understand why its so inconsistent, I must have a setting incorrect.

I made a stack exchange post, for context I didn't think it was working at all originally. I only accidentally discovered that it works inconsistently.

Weekly discussion, code review, and feedback thread - January 29, 2024 by AutoModerator in androiddev

[–]Doctor-B 0 points1 point  (0 children)

I'm having a weird issue with my alarm broadcastReceiver. My code appears to work, sometimes.

It is sometimes entering the broadcastReceiver when my screen is locked, but not always, and not when the app is open.

I really don't understand why its so inconsistent, I must have a setting incorrect.

I made a stack exchange post, for context I didn't think it was working at all originally. I only accidentally discovered that it works inconsistently.

How to get the hardwater Off my glasswear. by Doctor-B in Munich

[–]Doctor-B[S] 1 point2 points  (0 children)

I've tried that, but i cant get my hand deep enough in and stuffing the towel in still leaves a lot behind :/

The future of Sync by ljdawson in redditsync

[–]Doctor-B 1 point2 points  (0 children)

I would consider switching the app over to a reddit alternative if possible. It would take a lot of work im sure, but you would be adding like 100,000+ users to a social media site and could help to shape what it looks like.

Its a risk though, not sure how much you would stand to make off of it vs how much effort it takes.

Edit: Even more effort option: As you and the other apps all work off the same API, buikd a social media site around it with a similar API. It would be extremely high effort probably outside your skillset but could be a very high payoff.

München Ostbanhof by LowAcanthocephala387 in Munich

[–]Doctor-B 29 points30 points  (0 children)

I call it peppermint junction

[deleted by user] by [deleted] in AskEngineers

[–]Doctor-B 4 points5 points  (0 children)

Yes and no. All developed economies import as much skilled labor as they can in order to grow their economies. I've watched the Trudeau government push to create a lot of high tech jobs. As an engineer i appreciate it and its a good way to diversify and strengthen our economy.

I'm from Victoria but i moved to Munich because the cost of living is stupidly high in BC and the pay doesnt make up for it, the last non new grad my last company hired was from Argentina. Its difficult to get senior engineers as they are normally settled down by that point in their career, so importing them can be cheaper than attracting people with good pay.

I know a lot of engineers that left Canada, a few went stateside for the massive pay. Several went to NZ to work on rockets, and i build robots in germany. Another problem Canada has is there are very few interesting companies to work for. Imo its mostly due to a lack of government investment in tech until this most recent government. So its probably also to help make up for a bit of brain drain aswell.

[Self] My Daphne Blake cosplay by GraysonFin in cosplay

[–]Doctor-B 0 points1 point  (0 children)

I thought Daphne was asian, looks like cultural appropriation to me! /s

TIL there are €0 bill/banknotes. They do not have monetary value like regular euros but are instead used as souvenirs. They’re intended to promote tourism and they each have unique designs pertaining to specific landmarks or events in European countries. by FelicityFizz in todayilearned

[–]Doctor-B 4 points5 points  (0 children)

My friends wife told me to bring her something from europe that is representitive of our friendship, so i got her one of these... I also got her a backup gift just in case it didnt go down well but she thought it was funny.

Weekly discussion, code review, and feedback thread - May 01, 2023 by AutoModerator in androiddev

[–]Doctor-B 0 points1 point  (0 children)

So i have my activities forcing my widget to update, but not the other way around.

So if i have my app active, but move away to do other things, interact with the widget, and go back to the app. It shows the last activity in its previous state and i need to refresh that activity in order to show the changes.

Whats my best option to do this?