How can I deduct the Badge Counter on iOS by one every time the user reads a Push Notification from the tray? - xtify

I'm using the Xtify plug in through Application Craft.
After looking at Xtify's help page: http://developer.xtify.com/display/sdk/PhoneGap+Cordova+for+iOS+Xtify+Integration+Guide
at the section: To Manage the Badge Count
I found a set of functions to control the Badge Number.
But it is not clear from these functions, how can I deduct the Badge Counter by one, after the user reads one of the received notifications. For the moment I can only completely clear all notifications from the Tray (and the Badge Counter disappears).
But if the user has received 4 unread notifications, the badge counter is set to 4.
Then if the user reads one of these notifications, the badge counter is still stuck to "4".
I want to simply reduce the counter by one and remove only that "read" notication from the tray and not ALL notifications.
Any help would be really appreciated.

There are set/get badge javascript methods that will set and get the native iOS badge counts. However, this will only work if the Xtify native objective C plugin class is included in the application craft platform and compiled with the application. The javascript functions interact with the underlying Xtify xCode/obj-c functions.
That would be step 9-14 on this page:
http://developer.xtify.com/display/sdk/PhoneGap+Cordova+for+iOS+Xtify+Integration+Guide
Likely you will have to contact AC directly to support the Xtify native phonegap cordova plugin.

Related

Receive notification back from Xamarin Forms Maps

I have a Xamarin Forms app that, during it's execution, launches the Maps plugin (from the Essentials package). Here's the code that I use to launch the maps:
var location = new Location(latitude, longitude);
var options = new MapLaunchOptions
{
NavigationMode = NavigationMode.Driving
};
await Map.OpenAsync(location, options);
However, since I want the user to be directed to a location, I want to know when they get there; the idea being that some events occur within the app when the user arrives.
It looks, to me, like the Maps plug-in doesn't provide any kind of notification.
I've been through a few iterations of this. Initially, I thought of using the Geolocator to identify when the user arrives, then had a look at a Geofencing plug-in that I found.
Before I head down either of these rabbit holes: is it possible to get the Maps plug-in to tell me when the user arrives at a location.
It is possible by Creating the Custom Map to realize it in each platform.
You can create a Timer Task in Background service to execute getting current location from Geolocator (not a plugin).Then when current location is detination , message can be passed to where you want to do.
By the way , about native framework in each platform . There are some methods like UpdateLocation can be directly used to know the current location .
Such as :
IOS has startUpdatingLocation method to listen the current location.
Android has onLocationChanged method to know the current location if changed.
What need to do is to notification the user he has arrived the detination when the current position enters the range .

Clean UI elements watchOS 2 after lock

When the app starts is Apple watchOS2 it calls:
awakeWithContext
Then, if you lock and unlock the app, the lifecycle calls:
willActivate
The problem that I have is that I cannot remove the UI elements (clean screen), without user see the "old" screen during 1 second.
From the Apple documentation:
didDeactivate:
-Do not use this method to modify your interface......Modifications can be made only during initialization of your interface controller and between calls to willActivate and this method.
but then in willActivate method:
.... Do not use this method to perform the initial setup of your interface.
I don't know what I have to do to "clean" the screen when the user locks the app.
Thanks for your time.
The answer from Apple:
Thank you for contacting Apple Developer Technical Support (DTS). Our engineers have reviewed your request and have concluded that there is no supported way to achieve the desired functionality given the currently shipping system configurations.

How to specify no actions for android wear notifications?

I have a couple actions for my notifications, however I don't want any of them available on android wear. I know I can specify a list of custom actions for android wear, but how do I specify none? (I've tried addActions with an empty list, but no luck - then it just shows all the actions)
I don't think this is possible in standard way. If you specify at least 1 action in WearableExtender then normal actions will be replaced with wearable actions, but as you've said - you want to have 0 wearable actions.
For me you have 2 solutions:
Go with the API design post alternative versions of actions with your WearableExtender. If really any of phone actions cannot be used on watch maybe you can think of anything else that would be useful. It won't hurt user to be able to perform any action from watch. Of course if that makes sense in your case.
If you want to "hack" it a bit you can "clone" the notification and make them a part of the same group. If you would set one as a "group summary" that one will show up only on phone and other will be visible only on wearable. That way you have ability to setup completely independent set of actions.
Sample code:
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
// configure your builder without actions
builder.setGroup(GROUP_TAG);
builder.setGroupSummary(false);
notificationManager.notify(WEARABLE_NOTIFICATION_ID, builder.build());
// add some actions that will be visible only on phone
builder.addAction(...)
builder.addAction(...)
builder.setGroupSummary(true);
notificationManager.notify(PHONE_NOTIFICATION_ID, builder.build());

Adding alarm from BackgroundAgent (not working, looking for workarounds) - Windows Phone 8

I am developing an application which needs to notify the user at a pre-difined time with the help of background agent,
So I tried to add an Alarm, but according to MSDN's "Unsupported APIs for Background Agents for Windows Phone" all the methods regarding Microsoft.Phone.Scheduler (Add, Remove, Replace) are not supported (when ever i try to call Add method from background agent it gives error "BNS Error: The API can only be called from foreground app".). I tried to add the alarm when in foreground and then play with the "BeginTime" property and use the Replace method from the my scheduledTask (specifically, PeriodicTask which runs its code every 30 minutes) but to no avail, it did nothing.
What is important for me is to notify the user (with longer-enough sound) at the date and time that decided in the background-agent's Invoke method (My class derives from ScheduledTaskAgent and override the Invoke method), So I'm looking for workarounds. If there would be a toast that appears at a pre-defined time that would be ok somehow. Or maybe a toast that stays for a longer time on the top of the screen (from the moment the scheduled-task came up with an instance of DateTime until[and even after] the time that specifiend in this DateTime instance).
Please confirm, is it only the background agent that can calculate the correct time for the alarm to go off?
Assuming this is so, you can notify the user by sending a toast (which will also vibrate the phone, unless user has disabled that) and updating a tile pinned to the home page. These are both permitted APIs. So the toast message could tell the user to go look at the tile, which could have specific details about the alarm. The tile state will persist until you change it. If your foreground app would pin the tile for the user, that's a start. If you can then get the user to move the tile to the top of the screen, so it's always visible, you should be all set.
Considering that the alarm time might happen when the user is not actively using the phone, perhaps you want to do the toast plus a notification on the lock screen (as well as updating the tile)? That will provide another visual indication, though, again, it depends on the user configuring a lock screen.

How to schedule notification to user on specified time

In my app I need to schedule notification to user on specified date and time (for example 1st May at 10:00). At this moment notification must be shown and when user clicks on this notification, my app should be open. I see two ways to do it:
1. Scheduled notifications. But if I use the Alarm class, I can not change the title of the notification (which is "Alarm" in English version of SDK).
Reminder class mostly suits me, but when it appears atop the lock screen and user clicks it, my app doesn't open. May be is there a way around these moments? Also I would like to get rid of listpicker with time (5 min, 10 min, 1 hour, etc.) and the "snooze" button, but it's not critical.
2. Toast (or tile) notifications from background agent. But I'm not sure that my background agent runs at the right time. As I understand the background agents runs by the system, and their launch is limited by several factors (phone battery charge, the presence of the running applications or other background agents). It may not even start. There is a way to force the agent at a specific time by using the LaunchForTest, but everywhere write that this method can be used only for debugging purposes, and before the publication of the application it must be removed.
If I do not delete this method, will my application be certified? Also I don't like that the toast notification is only opens for 10 seconds and then disappears without a trace. Something can be done about it?
I need to notification was guaranteed shown at the right time, and when you click on it my application was open. What is the best way to do this?
If this is not possible in Windows Phone 7, is there a way to do this in Windows Phone 8?
Thanks.
I think you should use the Reminders for this. When you click them your application will open.
Something like:
var reminder = ScheduledActionService.Find("MyAppReminder");
if (reminder != null)
{
ScheduledActionService.Remove("MyAppReminder");
}
reminder = new Reminder("MyAppReminder")
{
Title = "Bla",
BeginTime = DateTime.Now.AddDays(2),
Content = message,
NavigationUri = new Uri("/Start.xaml", UriKind.Relative),
RecurrenceType = RecurrenceInterval.None
};
ScheduledActionService.Add(reminder);
As for the application not opening when the notification appears on the lock screen, it makes sense. Would be a big security hole if you could open apps directly from the lock screen! Hope it helps.

Resources