UILocalnotification is not appearing when the application is in the background - xamarin.ios

I have a monotouch application which has a timer and gets the data from the server.
Once the data is received i want to show the notification on the status bar.
It wrks fine when the app is in foreground. When the app is in background ,neither the timer nor the notification works
Please help me in rectifying this issue.

getting you app to run in the background is easy, add App registers for location updates in the info.plist, create a CLlocation singleton register for significant location change and you are done, your app will be resurrected every time there is a significant location change

When an iOS app transitions to the suspended (i. e. backgrounded) state, it stops its timers and disables locl notifications (and does some more memory optimization-related actions). A possible solution (JB only) to display user alerts while your app is in the background is to run a server (true unix server which is not bothered by an app getting backgrounded!) and use the undocumented CFUserNotificationDisplayAlert() function (just google it).

Your best chance is to extend the lifetime of your app by a little bit, by requesting a grace period in the background. As long as you receive this message during this time frame, you will be able to post the notification.
You do this by calling UIApplication.BeginBackgroundTask. This will let you run for a little bit, and the method you pass will be invoked shortly before your grace period runs out.

When you have an App with registers for location updates it seems to always run in the background to a certain extent, as you get significan location changes and you get the enter/exit regions, so you app is running code or is being waken up to run code... the problem is that the UILocalnotification doesn't trigger a sound and alert consitently ( but all the calls are displayed in the notification center... ) The big problem here is that the significan location changes, and the enter/exit regions are useless if you can not notify your user reliably.... is CFUserNotificationDisplayAlert() the only solution to trigger an alert to the user... ? does it work ? will your app be rejected if you use it ?

I got this working as follows :(Not a good design, but a working one)
Addded location support in info.plist, create a clocation manager and kept on requsting the location services. On the same loop schedule the UIlocalnotification .
It works perfectly. :)
NOTE : One issue is that it will give the user a propmpt as "This app uses your location, Do you want o allow"

Related

Is there a way to hold "STOP CASTING" for some time

I want to make an AJAX call for analytics purpose after user clicks on STOP CASTING and before receiver application actually shutdowns. Is there any message interceptor for STOP_CASTING? Or any other way to achieve this?
You cannot delay the stop casting behavior. There is typically a very small window where your code might have a chance to run. A more reliable way to handle analytics is to periodically post updates while the media is playing.

Spotify API player update event

Basically I want to display the current track on a website.
I already searched quite a bit for a possibility to get notified when player state (play/pause, track, current position) changes.
My question:
Is it possible to get notified (socket, hook call) or is the only possibility I have to call the Web API like every second and fetch the state?
I fear that I'm running into rate limits when multiple users connect their accounts and display the current track.
Nope, there's still no way to do that. To achieve what you'd like, you need to pool the Spotify API continuously.
You can however use the Spotify SDK that you can pass a function to be executed on playback state change. The SDK is incompatible with a few platforms (see supported browsers), but for those you could catch the SDK initialization error and then switch to continuous polling via the API. You will have a lot fewer requests then.
A second option would be to only update the currently playing song after the last song should have ended. When getting the playback state for the currently playing song, you could use the field duration_ms and progress_ms to calculate the remaining time of the song. Then schedule another API requests for when the song should have ended and you're good. Whether that's a good strategy for your use case or not depends on the type of playback and how often the playback changes in your app.
I hope I could help!
As of now, it seems to be possible to receive player state events with a listener:
https://developer.spotify.com/documentation/web-playback-sdk/guide/#playback-information-display
I haven't tested the Web version, I'm currently using the analogous Android APIs, and Android's seems to work for play/pause change and track change (but not for position change)

Azure Logic App fails to send message to slack

We have some Logic Apps setup that monitor our various sites and a Slack connection set up. If a non-200 status code is returned, it sends a message to our alerts channel in Slack. We have about 10 sites that are monitored.
The first was setup, tested the cloned for the other sites.
The issue we're having is that they all seem to work bar one.
The site in question was offline this morning (after host updated the server at 3am this morning) and I can in the Azure log the trigger was fired - but no message in Slack.
I changed the Condition to "status equals 200" (to ensure it always fires), ran it manually and still see no message.
As mentioned this logic app was cloned from one that did work so the only thing that changes from app to app is the site URL and the contents of the slack message.
Being relatively new to various Azure features this was a bit of "R&D" for Logic Apps so I'm not really sure what to check.
Any obvious gotchas we should be aware of? Any pointers you can give to help resolve this would be great.
NB: I added Slack API as a tag to this but as this part is handled by Azure and it's working for other Logic Apps feel free to remove.

Twilio SMS with links - links being clicked automatically?

I have an app that sends SMS's out to a bunch of people. Those messages contain links. They are not using any link shorteners or any other service. They link back to my site. The links themselves are randomized strings, which are stored in my db, which are associated with an action. (Click "yes" or "no" link and the db tracks what you chose.) For ALL users, this works perfectly. With one user - and it's always the same user, as soon as the cron job runs, which triggers this event, his "vote" comes in. This is without him clicking or even seeing the message sometimes.
So, the question: has anyone ever seen or heard of a cell provider or a messaging app or similar that "clicks" links as part of some process before sharing the content with the user? I can't see ANYTHING in the code that would single him out so I'm thinking it has to be something in between when the message goes out and he does what he does. Especially because the timestamp is also always within seconds of the cron job running.
Sending an SMS can sometimes go through multiple carriers before reaching an end destination. As such, providers may be "handling" the content in this case.
The best thing to do would for any cases of this in the future would be to write support for further investigation.

Messaging Application only gets Security Certificates Once

I'm developing a messaging application that runs within a larger program. When the user logs off in the main program, an event is triggered to log them off in my module. The same occurs for log on. Right now the first user gets in fine, but there is an error about accepting the security certificate every time the second user tries to get in. I have no idea why this error would exist as the first user gets in fine, and the logic is the same. I know this isn't a ton to go on, but are there any obvious things I should check?
I'm using C# with Jabber.NET as my main XMPP library.
Did you wire up the OnInvalidCertificate callback in one and not the other?

Resources