I am creating an application which uses the facebook api, and I want facebook authentication done in Myservice class which is long running class extends Service class of Android.
facebook.authorize(activity,dialog) method runs in any activity but it is not running in service class.
I know the methods parameter contains activity, but if we want to authorize Facebook in Service class then what do we have to do?
It’s my first project so I dont have that much idea how to solve this problem.
You can achieve this with BroadCast.
In your service, when you need to launch fb authorization dialog, you can send broadcast Intent. In your activities, you should register broadcast receiver, which should get that Intent from your service. Than you can launch fb dialog from Activity context.