Receive notification back from Xamarin Forms Maps - xamarin

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 .

Related

Need to tell users when update occurs

I want to notify all the app users to update the app (through a popup in the app itself) whenever there is a new version deployed in the stores. Can someone suggest the best way to do that?
Luckily, we do have solution for iOS app store
string url = "http://itunes.apple.com/lookup?bundleId=com.xxx.xxxxx";
HttpClient httpClient = new HttpClient();
Task<string> jsonString = httpClient.GetStringAsync(string.Format(
var lookup = JsonConvert.DeserializeObject<Dictionary<string, object>>(jsonString.Result);
But Now I need to get the current version of App from Google Play Store?
Let's say you want to notify the users about a new version of the app every time they open the application, then you should just trigger a simple GET call to retrieve the latest version info or use a third party lib to act accordingly.
0 cost simple solutions
One option would be to ask the API (if there is any) if a new version is available - basically delegate the problem to someone else. If there is no backend the app could do the check itself. There are different options from having a simple txt file hosted somewhere with the latest app version to scraping App Store and Play Store for the current published version of the app.
Existing solutions
https://appgrades.io/
https://github.com/ArtSabintsev/Siren
Use Push Notifications to notify your users
You will find more if you google it
Platform specific solutions
For iStuff (Apple) you could use iTunes Search API as mentioned here
Other platforms may have their own APIs
Depends on the specific case you can decide what will work better for you.
P.S.: Be sure to handle the versioning correctly by bumping the app version on each release.

How to make a Finder Sync Extension change badges in response to outside events

I have a Finder Sync Extension that will display a badge on a file based on the state of a local database. It's straightforward enough to query this database in the requestBadgeIdentifierForURL function, but what if I want the badge to change for a Finder item that's already visible if the state of that database has changed (which can be via a notification through any variety of mechanisms). The documentation (https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/Finder.html) would seem to imply this is possible with this statement:
You might also want to track these URLs, in order to update their
badges whenever their state changes.
The only ways I can imagine this would be possible (and most seem wrong) would be:
call setBadgeIdentifier:forURL from another application that is aware of the change
Launch a thread in the init function of my extension which listens for notifications and calls setBadgeIdentifier:forURL when it receives them
Call some OS API that prompts Finder that the extension should be triggered via requestBadgeIdentifierForURL.
Only the last one seems feasible, and could be managed via the extension informing the outside resource what needs refreshing via the beginObservingDirectoryAtURL/endObservingDirectoryAtURL callbacks, but i don't know what mechanism could do this.

Branch.io: detect first install from Unity

Trying to detect the first install event from branch.io link (succesfully implement link creating and sharing). I am using Unity branch sdk. The feature i try to create:
user_1 creates and share link to user_2.
When user_2 opens the link and install app i need to reward both of them (with inner in-game coins)
So i succesfully implement the 1. but I cant understand how to detect is user_2 installs the app or simply open it. All data that comes from branch.io UniversalObject callback doesn't contain information that i need.
Which the correct way to detect the install from code?
Alex from Branch here.
The callback parameter you need is +is_first_session. This is one of the parameters returned when the Branch session is initiated each time your app opens (you can find all all these parameters here). If this returns true, then that device has just installed the app (instead of opening it).
However, note that when these parameters are returned, it's impossible to immediately determine if the user is new (what you want), the device is new (not what you want, since the reward could be given twice if the user has installed on multiple devices), or neither (the user deleted the app and reinstalled on the same device). You would probably want to hold off on actually awarding the referral points until after the user has logged in with some sort of unique ID.
Branch also has a built-in feature for tracking referral points that might be useful. That lets you configure all the rules using the dashboard UI instead of needing to do it programmatically inside your app.

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());

Facebook Open Graph Beta - Can't create action because I already use it

The new Open Graph beta is telling me that I cannot use the action 'want' or the object 'item'
I have used them in previous applications, however these have since been deleted and I've created a new application where I cannot use it.
Is this a bug, or am I doing something wrong?
Perhaps the types are not defined in the namespace you're using (or they were restricted to the app that defined them). If the types have not been created within the new application, you probably should use the Get Started tool that's available in the Open Graph section on the app control panel to create you Action and Object types.

Resources