-2

I'm not a software developer at all, but wondering if this would be a relatively simple project for creating an android shortcut.

My parents like doing the guardian quick crossword: https://www.theguardian.com/crosswords/quick/, I was thinking as a project with some practical purpose would to be have an app where it would take you to the crossword of the day in a different browser app. eg. https://www.theguardian.com/crosswords/quick/15049, the number at the end relates to the day so 15049 = today. There isn't a crossword on sunday, so there would have to be a simple line of code for the number.

There is a speedy crossword on sunday so that has a different web address: https://www.theguardian.com/crosswords/series/speedy

I can write a bit of code in python to do it:

def guardiancrossword():
import datetime
import webbrowser
today = datetime.date.today()
someday = datetime.date(2018, 7, 29)
diff = today - someday
d = diff.days
if d%7 == 0:
    x = int(d/7.0 + 1191)
    webbrowser.open('https://www.theguardian.com/crosswords/speedy/'+str(x))
else:
    x = int(d%7+((d - d%7)/7.0)*6 + 15046)
    webbrowser.open('https://www.theguardian.com/crosswords/quick/'+str(x))

Any Ideas as if this is a feasible project or is there some way to do this in a browser. Ideally it would be running on an android tablet.

Now per a suggestion I think a web page that executes the script to get the correct link would be better, but I don't know how you do that.

Thanks.

  • Perhaps not exactly opening a browser, but certainly an android phone could create a notification indicating that a new puzzle is available, and clicking on that notification could take the user to the page itself! – Neil Aug 1 '18 at 8:49
  • 1
    yes this is possible. It is sufficient to create a simple website that redirects to the correct link, and to pin that website to the home screen so that it can be used like an app. – amon Aug 1 '18 at 8:57
  • @amon, that is a good idea, can I create a website that runs a simple bit of code like my python above? That would actually be better as then I can have a bookmark running on the computer as well, that would find the right page. – JimSi Aug 1 '18 at 9:21
  • @Neil Can you get the notification to run a bit of code to work out the right link to the web page, as the correct web page address changes every day. – JimSi Aug 1 '18 at 9:22
1

I would suggest the best way to do this would be to use a widget.

A widget can appear as a simple icon on the device, but when clicked you have the opportunity to run code. In your case, calculate the crossword number for the current day and open a web browser.

You would also be able to add various options to allow the selection of the crossword type, but without the overhead of launching a full app.

You can see that creating a simple widget is pretty easy, comparable to your python example. although you will have some extra complexity around publishing it.

https://developer.android.com/guide/topics/appwidgets/

However, I would be careful about attempting to sell such an app commercially. This kind of 'Deep Linking' is frowned upon by publishers and the Guardian has already launched and withdrawn an app because they were unable to get enough people to pay for it.

https://www.theguardian.com/help/insideguardian/2013/jan/22/crosswords-app-update

1

Here's an alternative route that may or may not be easier.

Can you re-write that python logic using JavaScript? If so, create a CodePen or JSFiddle or something similar. On page load, run your JavaScript and at the end have the JS code redirect you to the URL you created.

After that, just go to the URL for the Pen/Fiddle you've created on your phone and save a shortcut to that on your phone's home screen (Chrome and Firefox for Android support this, I'm sure others do too).

The benefit here is you wouldn't have to learn anything about Android development to get an app icon created.

Edit: I see amon has suggested basically this in the comments.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.