Add-on API For Android App

Fayettemat

Member
Hey PHP+Xenforo Devs! I'm looking at likely making an Android app for forum browsing that will be similar to what TapaTalk once was. The API will be for an an Android app that's currently in the concept phases but one that I do plan on releasing if there's enough interest.

I don't know enough about XenForo's internals to know what's possible out out this but at the minimum I'd need to be able to have the following in the API.

XenForo Core Features
  • Login/Logout Functions
    • Support 2FA
    • Support Facebook, Google Auth
    • I do not want them to be able to sign up using
  • Ability to poll the server for update to personal things
    • Alerts
    • Messages
    • Moderation notices (for moderators/Admins)
  • Private Messaging Support (reply and send)
  • Ability to post treads and polls
  • XF 1.5 Tagging Support
  • XF Resource Manage/XF Media Gallery
  • Full support of existing permissions
  • Ability to report ports
Xenforo Admin Features
  • Ability to restrict users from using API via permissions
  • Moderation handling
That is all I can think of at this time for it... but I'm sure more will come up. Ideally I would like someone who's willing to work together with me for an Android (XenForo) Forum Browsing app.

Important points about the actual app.
  • Don't plan on putting any sort of ads in the app on my end and not sure about allowing forum-based ads either (depends on interest and being able to implement)
    • Might be willing to allow the forum owner to display adds using an addon that can be worked with an approved by me and the API developer (basically maybe in the future)
  • Don't plan to store any sort of information about your users on my end (including the forums they use).
    • The only information that I'd have is what ever Google's Play Store gives to those who publish an app.
    • There will be no "app login" needed to use the app, nor do I plan to sync user's forums currently
    • Syncing might be a future feature (if demanded).
  • Since I absolutely hate the way some apps promoted communities and allowed you to search for them! I'd make it so that they'd have to prove your URL or some similar method where it's given to the app by your forum or the end user.
  • Won't be making any sort of "in-app forum directory"
  • Might publish a list of forums who are using it (and opt-in) on a web site in the future (TBD)
  • Don't plan on making an iOS version (sorry).
  • Will likely allow third parties to use same API but if they are they will have to agree to a set of terms that prevents them from doing stuff that I am against (listed above)
 
Last edited:
Think about doing something that use what mobile phones are good for. Mobile phones are good for:

- push notifications (be notified when an alert or a PM arrives to an account)
- snap photos (easy way to include a photo in a post or the XenMedia Gallery)
- sharing content (share a photo, thread, post)
- fast content consumption (think about facebook or twitter, you just scroll and you are presented with all the content relevant to you. XenForo has threads, media, profile posts, etc. Why not invent something that presents all this information within a scrollable container)
 
I think there are already a couple of add-ons that have their own type of API calls into XenForo.
Yeah there is, but as far as I know, there's no way to do it all in one API..

Think about doing something that use what mobile phones are good for. Mobile phones are good for:

- push notifications (be notified when an alert or a PM arrives to an account)
- snap photos (easy way to include a photo in a post or the XenMedia Gallery)
- sharing content (share a photo, thread, post)
- fast content consumption (think about facebook or twitter, you just scroll and you are presented with all the content relevant to you. XenForo has threads, media, profile posts, etc. Why not invent something that presents all this information within a scrollable container)

Push notices are almost a must with a ton these days (hence wanting to be able to poll for the above items). I'm not sure if I want to totally reinvent the wheel.. Might be worthwhile to have a secondary function that can be enabled and automatically refreshes the API and appends it to the top ever so often (2 minutes?). I would stop it from doing that while the app is closed though.. Waste of battery to keep a 100% live stream going that often...

Basically:
  • I plan on having push notices. I'm just not 100% sure how I want to implement this as I'd have to either
    • keep the app running in the background using various methods and tell it to poll that way.. Think of how GMail polls IMAP servers.. (wastes battery).
    • have the API automatically allow devices to "register" and push FROM that forum on the notices (would need to run on a cron and relies on the forum)
  • I want XFMG support mostly for that very reason. To enable people to take a picture on the phone (from the app) and upload it straight to a gallery.
  • With Android there is a sharing menu so I'd likely use that function to share it. That'd enable them to use other apps to share including SMS, MMS, installed apps that allow that (social networks, IM clients, etc)
  • Based on XenForo's layout on the front end and user tagging I'm not sure how we'd implement the content consumption similar to social networks. We can do a "live reload" (see above) and "infinite scrolling" (think of how Twitter will keep adding and showing older tweets the more you scroll down).
As stated, still drafting out ideas and such and need an API that can implement the above in a simple package for forum owners to use and then I can start making use of such an API. If I had my way (and would love to especially in this case) I'd find someone interested in becoming a joint team for this and we'd work together on getting new things added! Granted, I can use a semi in-place API that's built for the above stuff, but I don't know that I'd be able to implement a ton of things that I want to that way.

PS: As soon as I can get it done after the API is done I'll let a few forum owners test the app that want to.
 
Yeah there is, but as far as I know, there's no way to do it all in one API..



Push notices are almost a must with a ton these days (hence wanting to be able to poll for the above items). I'm not sure if I want to totally reinvent the wheel.. Might be worthwhile to have a secondary function that can be enabled and automatically refreshes the API and appends it to the top ever so often (2 minutes?). I would stop it from doing that while the app is closed though.. Waste of battery to keep a 100% live stream going that often...

Basically:
  • I plan on having push notices. I'm just not 100% sure how I want to implement this as I'd have to either
    • keep the app running in the background using various methods and tell it to poll that way.. Think of how GMail polls IMAP servers.. (wastes battery).
    • have the API automatically allow devices to "register" and push FROM that forum on the notices (would need to run on a cron and relies on the forum)
  • I want XFMG support mostly for that very reason. To enable people to take a picture on the phone (from the app) and upload it straight to a gallery.
  • With Android there is a sharing menu so I'd likely use that function to share it. That'd enable them to use other apps to share including SMS, MMS, installed apps that allow that (social networks, IM clients, etc)
  • Based on XenForo's layout on the front end and user tagging I'm not sure how we'd implement the content consumption similar to social networks. We can do a "live reload" (see above) and "infinite scrolling" (think of how Twitter will keep adding and showing older tweets the more you scroll down).
As stated, still drafting out ideas and such and need an API that can implement the above in a simple package for forum owners to use and then I can start making use of such an API. If I had my way (and would love to especially in this case) I'd find someone interested in becoming a joint team for this and we'd work together on getting new things added! Granted, I can use a semi in-place API that's built for the above stuff, but I don't know that I'd be able to implement a ton of things that I want to that way.

PS: As soon as I can get it done after the API is done I'll let a few forum owners test the app that want to.
Why not use [bd] Api?
 
I considered that one, however, I don't think it supports permission-based views. If I'm wrong please correct me.
Yep! It's support permission-bases views. Eg: When display an thread.

Code:
{
thread: {
thread_id: (int),
forum_id: (int),
thread_title: (string),
thread_view_count: (int),
thread_post_count: (int),
creator_user_id: (int),
creator_username: (string),
user_is_ignored: (boolean), # since forum-2015072304
thread_create_date: (unix timestamp in seconds),
thread_update_date: (unix timestamp in seconds),
thread_is_published: (boolean),
thread_is_deleted: (boolean),
thread_is_sticky: (boolean),
thread_is_followed: (boolean), # since forum-2014052903
first_post: (post),
thread_tags { # since forum-2015091001
(tag id): (tag text),
...
},
links: {
permalink: (uri),
detail: (uri),
forum: (uri),
posts: (uri),
first_poster: (uri),
first_post: (uri),
last_poster: (uri),
last_post: (uri)
},
permissions: {
view: (boolean),
edit: (boolean),
delete: (boolean),
follow: (boolean), # since forum-2014052903
post: (boolean),
upload_attachment: (boolean), # since forum-2014081203
edit_tags: (boolean), # since forum-2015091102
}
}
}
As you see the permissions key was included. And your app should be use that key to restrict.
 
Those perms do look good, but still missing stuff like the ability to set a cron to push notices to registered clients and the like.

I suppose I could look into seeing if I can get the bd one modified as it looks more like what I want then the XenAPI. Any one want to do that? Maybe @xfrocks himself?
 
If you want to push notices, so consider to use Socket or something similar to save your resources.
That's not a bad idea, but not sure how it would work in this case. I'll look into push notices on Android a bit really quick as I've not played with them before.
 
I considered that one, however, I don't think it supports permission-based views. If I'm wrong please correct me.
It does support permission view and basically everything you need IMO. It's open source also so you can fork it from github if you need something specific (and maybe submit a pull request later?). The add-on [bd] API also supports PubSubHubbub so you can use it to subscribe to user alerts and such and use GCM or any other message delivery system you want to use. The github repo includes an Android Demo application too: https://github.com/xfrocks/bdApi/tree/master/android_demo
 
I am indeed. I'm now debating if I want to do a native or web view one like the one thread that was posted recently. My main reservation about web view is that it's not as clean and it's kind of obvious that it's a browser in a shell.

What's your opinion on that @Daniel Hood?

Edit:
@xfrocks I'm not familiar with XenForo's methods/functions yet which is why I was looking for an API and yours does look nice. Also, I'm curious as to what you did for the GCM part to get it to run. Is it actually on a cron or done in some other manner? Been shifting through your code on GitHub recently and haven't fully gone through yet.
 
Web view doesn't work optimally for small screens as it caters to any kind of screen size. With native you can ignore functions that are not optimal on small screens and have optimal UI only.
 
I was actually referring to @xfrocks in my first post. However, I think making a webview app is a bad decision. If you're going to put in the effort and are capable of doing it, a native app would be a million times better.
 
Web view doesn't work optimally for small screens as it caters to any kind of screen size. With native you can ignore functions that are not optimal on small screens and have optimal UI only.

I was actually referring to @xfrocks in my first post. However, I think making a webview app is a bad decision. If you're going to put in the effort and are capable of doing it, a native app would be a million times better.

That's actually what I was thinking myself. Webview is a ****ty way to do it.. I was going for full native just some people have seemed to be getting insanely excited over that one guy who's doing that.. I just don't get why that'd be "better".
 
Top Bottom