How do I check how many times facebook have been opened? I'm using Xamarin.android with C#.
My goal is to check how many times facebook have been opened. I want to increment a integer, each time the user opens the facebook app.
I have been looking at app usage statistics but it just seems very difficult. If anyone could provide me with a snippet or something, it would be great!
Here's my fragment code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Util;
using Android.Views;
using Android.Widget;
namespace MyApp
{
public class Fragment1 : Android.Support.V4.App.Fragment
{
private ISharedPreferences prefs;
private ISharedPreferencesEditor editor;
private int totalCount;
public override void OnCreate (Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
editor = prefs.Edit();
}
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View view = inflater.Inflate(Resource.Layout.Fragment1, container, false);
TextView faceText = view.FindViewById<TextView>(Resource.Id.faceTextView1);
return view;
}
}
}
Thanks in advance!
There are a few ideas outlined here, but overall it's hard to get information about an app on the user's device from your app, unless the user goes through your app to launch Facebook.
You'd have to have a service running in the background listening for the user to open another app, and some way of verifying the other app had been opened, without access to the other app's code.