Geofence and send push notifications - javascript

before I learn react native from scratch, I was wondering if it is possible to geofence certain areas and then send push notifications to the user when he enters the geofenced areas even if he is currently not using the app. Thank you

You can access official documentation of Push Notification:
https://facebook.github.io/react-native/docs/pushnotificationios.html
Added a sample apps for you to take a look:
https://github.com/transistorsoft/rn-background-geolocation-demo
https://github.com/zo0r/react-native-push-notification
Basically you should enable push notification in your project and save the location you get from the navigator.geolocation.getCurrentPosition callback somewhere in you app, you could use AsyncStorage for that purpose. callback is only called if the location is changed.

Related

Using AWS SDK to help call and allow a user create a tracker API in JavaScript?

Ive been trying to create a form where users can provide a name and location then create a tracker, to be used alongside Location Services Maps. I fee like i am close but am not sure why its not working nor rendering.
A few initial thoughts based on the code snippet you shared:
I don't know enough about your use case, you wouldn't need to have more than one tracker per asset type when tracking moving objects. If that's the case for you, create trackers using AWS CLI or AWS Console.
If you'd like to create trackers using the JavaScript SDK, first, you need to authenticate your request. See Prerequisites for using Amazon Location Service and Geofencing and Tracking to get more information.
Check your input parameters (params) against the CreateTracker API requirements and make sure you're using the right parameters and passing the right values.
Check your browser's console and post the errors you're getting here to help me better understand the issue.
Note that createTracker creates a new tracker that does not have any data - this means that there is nothing to render yet. To track your assets, you'll need to send position updates to the tracker. See Start Tracking for an example.
Share a bit more about your use case, i.e., what is it you're trying to do. That'll help me better understand the problem.
UPDATE: here is what I'd do for your use case:
Create a tracker using AWS Console or AWS CLI.
Use AWS Amplify to push position updates to the tracker when building iOS or Android apps.
Use AWS IoT Core to send position updates to the tracker when building something else like a web app. See Tracking using MQTT with Amazon Location Service for an example. I'd consider AWS Amplify PubSub to send/receive messages to AWS IoT Core when building on the web.
Send metadata like the name of the food truck, food type, etc. along with position updates using PositionProperties - see Update your tracker with a device position. This would help me attach more information for data visualization or analysis purposes.
Hope this helps.

How to make a chat application in react native?

I have build chat UI for my application using react-native-gifted-chat. I have connected the sent messages and received messages with the services. Can anyone help me with the issue of messages not getting updated instantly as the message is received?
Do I need to hit services again and again to refresh the chat message? if yes then how?
Or do I need to implement some kind of push notification? if yes then how?
I just want to make my chat screen update the message instantly when current user receives a message from another user.
Well, for update the message instantly when current user receives a message from another user you need to use firebase realtime database. it provides you to live data instantly..(for more info refer this tutorial https://medium.com/#platypus/react-native-chat-application-679dbff3ccd3)
and for other option Socket.io also provides live data and it is better than firebase realtime database.

Send Push Notification from Web Application using AWS PinPoint

I have a react web application that assigns tickets and a react-native app for user to see their assigned tickets. I want to be able to send a push notification to the user when they are assigned a ticket. I'm looking through PinPoint JavaScript SDK, but having trouble seeing if I can do it. Has anyone been able to accomplish this?
I was able to accomplish this. You use AWS Amplify Analytics to put UserId or any attribute you want to be associated with a user. Then Use Pinpoint SDK to createSegment which attributes target the ones associated with the user. Then Pinpoint SDK to createCampaign for created segment. Hope this helps.

React Native display message at certain time when app is disabled

How is it possible to have React Native trigger some kind of message on the device at a certain time, even if the app is currently not selected or closed down altogether?
I would simply use a push notification. This is something you will need to setup server side but it sounds like you have a good use case. You will need to setup permissions etc for this.
Maybe also a good use case for local notifications take a look at React Native Docs
A small completion to #JamesWatling's answer. You'll need at least:
AppState (https://facebook.github.io/react-native/docs/appstate.html#content) to post the timestamp to server, when app is moved to background
Push Notifications (e.g. https://onesignal.com/ or for iOS: https://facebook.github.io/react-native/docs/pushnotificationios.html#content) to send a notification after certain amount of time
You might want to have a look at this part of the react native documentation and focus on local notifications. You don't need a server or anything to schedule a notification at a given time, a local notification is scheduled without a server interfering.
I do believe your app is going to need to have permissions for push notifications though (so the app is allowed to display a message on a homescreen for instance)

React native Cloudkit push notifications in android

How to register for cloudkit push notifications in react-native android?
Thanks!
I'm not sure what the influence of react native is, but generally speaking CloudKit would function like this:
If you are using the webservice api, then you can only modify subscriptions. You can not register for a subscription. See: https://developer.apple.com/library/ios/documentation/DataManagement/Conceptual/CloutKitWebServicesReference/Introduction/Introduction.html
If you are using the javascript api, then you can also subscribe. See https://developer.apple.com/library/ios/documentation/CloudKitJS/Reference/CloudKitJSTypesReference/index.html#//apple_ref/javascript/struct/CloudKit.Subscription
I assume that the javascript subscription will only work as long as your application is active and your created subscription is active. I have no experience with this, so I could be wrong.

Categories

Resources