I am working on Android C#
app which tracks user's stocks price. I want the app to push notification (in background) whenever the value of stock increase 1%. I have searched online and I know I need to use BroadcastReceiver
and Services
but I am not able to implement my own code and I haven't found a tutorial or a published exemple on how to do it. I am sure the solution will be very easy but Ia m not able to get it. So again, I want to push notification in bachground whenever the var price
goes up by 1%.. Please Help me to do so.. Thank you
Here's what I have till now:
[BroadcastReceiver]
public class MyReciver : Android.Content.BroadcastReceiver
{
public override void OnReceive(Context context, Intent intent)
{
}
}
I have provided a demo on github .
In my project, there are two button, the first one is to register the broadcast, and start a service for your app. The second one is to imitate increase the price, you can change it base upon yours. I have add comments in my project.
Here is how to use the BroadcasetReceiver
in Xamarin.Android. And here is how to use the Service
. Here is how to push a notification in Xamarin.Android.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.