PhoneGap, Rants

Playing with Evil: Using PhoneGap Build for iOS in Linux

As I am not “fortunate” to have an AppleOS machine to compile a custom plugin for a PhoneGap app. Rather than wait indefinitely for one to be ordered I managed to work around the XCode dependency but still faced the prospect of getting said modified app onto an actual device. Here lies the log of the removal of my immortal soul to be sacrificed to our blessed overlords of Apple. Hail.

Step 1 – Pay for your sins

There is no getting out of forking cash to Apple – even if you plan on just developing test apps for yourself. This. Is. Sad.

So pay for your sins literally. Go through the iOS registration process. Have a cry or strap yourself down to prevent inadvertently killing all living beings (not good for future job prospects) within a 10 mile radius when the registration process goes wrong/takes too long/doesn’t tell you you put your phone number in a format Apple doesn’t like since you’re not in the US*.. dumbass.

Anyway; crisis averted (if you heed my advice about a nice straightjacket). Mourn the loss of your eternal soul.

* BTW: for UK numbers this means that the region code is ’44’ and if you don’t have an extension like I don’t then I put ‘-‘

Step 2 – Get stalked

You will need to register at least one device, which will require knowing the UIID. Plug in your iPhone and run*:


lsusb -s :`lsusb | grep iPhone | cut -d ' ' -f 4 | sed 's/://'` -v | grep iSerial | awk '{print $3}'

*From dakira

Step 3 – Register pointlessly even if it’s just for development

Follow roughly in the steps of this beginner’s guide and ignore 1) the mention of Dreamweaver and 2) the expectation you have a Mac..

Step 3.1 – p12 certificates

You need to download your developers key, which you get from your developer account console. You then generate a file called ios_development.cer

Now:

// replace {Your-Apple-Stalk-ID} with the account name you are associating the stalkyness with
openssl req -subj "/CN={Your-Apple-Stalk-ID}/O=User" -nodes -newkey rsa:2048 -keyout private.key -out request.csr
// download your ios dev cert, then:
openssl x509 -inform der -in ios_development.cer -out certificate.pem
openssl pkcs12 -export -in certificate.pem -inkey private.key -name "iOS Developement Certificate" -out certificate_with_key.p12
// you should be prompted to input password

You thus have certificate_with_key.p12 generated. Remember your password – stick it in a file with the rest of that crap.

Step 3.2 – Provisioning profiles

You now have 1) a registered device 2) a p12 certificate to register the provisioning profile. Follow the prompts to register an App ID. Associate all 3, then rejoice. Briefly. Minor victory is yours

Step 4 – PhoneGaaaap

Ensure you have your app ready to go. Notice that the iOS build is broken due to the missing profile and certificate. Use the prompts and then recall that password you saved – things aren’t unlocked for use. Once the lock symbol isn’t revelling in your insufficiencies to handle such overly complicated processes rebuild your app in the evil overlord format.

Things should have worked. If not, follow these steps then ‘Build’.

You are still dealing with the evils. Ignore urge to motion your head swiftly and violently onto your desk/nearby wall/friendly police officer.

Step 5 …

:/ Observe the QR code. Attempt to scan said QR code with iPhone as if it were an Android device with the ‘Camera’ application. Pick up jaw from floor realizing that there is no built-in scanning application. Attempt to download QR scanning app. Discover this needs the Apple-Stalk-ID for installing on your test-department device (hell as if you’d have one otherwise). Weep. Go to the URL of the ‘install binary’ for iPhone and get a generic 404 message. Scratch head and stop yourself from introducing the test iPhone to the floor with extreme prejudice..

Go to the PhoneGap build login page on the evil-device iPhone. Log in with your PhoneGap Build details. Go to ‘Apps’. Click download.

Watch as the app gets installed automatically.

...

Also, if you don’t have a paid PhoneGap Build account you will need to delete your old app and redo the key sign-in before rebuilding. Normally one would say “happy coding” but “faffing” is more accurate. :C

It.. updated.. yay...

It.. updated.. yay…

** Image credits to MS Paint Adventures

Standard

(The proper) Cambridge Blue

(The proper) Cambridge Blue

You’re another city, you’re about to have very short days until next summer, but at least you still have this view.

Random

Cambridge – Blue

Image
Android, Rants

Looks like I’m not the only one.

Adding contacts to my apps has helped me get in touch with real-life users but I didn’t count on spam marketeers – being exclusive to Google Play and using a Gmail address I thought I was relatively safe from with their spam filtering.

Link
Rants
I have no words

I have no words*

I’m forever an immigrant: my parents moved to Australia when I was very young, and now I’m prepared to try and settle here in the UK. My parents were considered ‘skilled’ migrants so they’re the run-of-the-mill variety of *ordinary* people making an *honest* living. I’ve been spoiled as the product of my parent’s and forebearer’s struggles – all that need concern me are first world problems.

No doubt immigration is a delicate subject.

But I see shit like this, in this day and age.. It just makes me sad.

** If it’s not clear, I am exasperated that the ‘immigration is a positive’ was downvoted so much compared to the others veering towards the ‘Rs’ *sigh*

“I’m not racist, but…”

Aside
SlidingDrawer in action
Android

SlidingDrawer is dead. Long live SlidingDrawer!

Well, after doing some work-related Android development I went to see to fitting a SlidingDrawer to some basic content but alas things have changed since I first used it for the Letchworth app. Though deprecation doesn’t mean immediate incompatibility it does signal that it can be dropped from being supported at all in the near future.

SlidingDrawer in action

SlidingDrawer in action – sliding out extra content

Naturally the Android developer suggestion was to just resurrect the code as its source code is available, but I kept hitting issues that weren’t elaborated in existing tips online. After finally collecting enough of a trail from various sources, I think I have all the steps you would need in one place (assuming that you’ve experienced using SlidingDrawer):

  1. Copy SlidingDrawer into your package. I will for this example copy and rename appropriately the class to MySlider and place it in package com.foo.prettyui
  2. Add to /res/values/attr.xml a copy of the sliding drawer styleables. For ease of reuse, refer the name value to your class name – in this case ‘MySlider’
    <?xml version="1.0" encoding="UTF-8"?>
    <resources>
    	<declare-styleable name="MySlider">
    		<attr name="handle" format="reference" />
    		<attr name="content" format="reference" />
    		<attr name="orientation"  format="integer" />
    		<attr name="bottomOffset" format="dimension" />
    		<attr name="topOffset" format="dimension" />
    		<attr name="allowSingleTap" format="boolean" />
    		<attr name="animateOnClick" format="boolean" />
    	</declare-styleable>
    </resources>
  3. Change your cloned code into using the styleable attributes that you have just declared – ie: replace all instances of R.styleable.SlidingDrawer_bottomOffset to R.styleable.MySlider_bottomOffset in MySlider.java. At the end of this stage you should check if it all compiles – hopefully things are fine which would mean it’s ready to use
  4. How to use it: you need to add the package MySlider is in by adding it as another namespace at the top of with the xml declaration (alongside the android schema). For this example
    xmlns:prettyui="http://schemas.android.com/apk/res/com.foo.prettyui" I’ve declared prettyui as my new namespace – you will need to use this for any of the SlidingDrawer MySlider styleable atributes – namely handle and content (the minimum required), so to continue:

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
    xmlns:prettyui="http://schemas.android.com/apk/res/com.foo.prettyui"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    ..OTHER STUFF..
     
    <com.foo.prettyui.MySlider
            android:layout_alignParentBottom="true"
            android:id="@+id/questionanswer_related_drawer"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            prettyui:handle="@+id/slider_button"
            prettyui:content="@+id/slider_section">
    ..YOUR SLIDING DRAWER STUFF..
    ..WHICH SHOULD INCLUDE 2 LAYOUTS WITH THE IDS AS STATED IN HANDLE/CONTENT..
    </com.foo.prettyui.MySlider>
     
    ..MORE STUFF..
    </RelativeLayout>
  5. The above layout attributes can be reused if you decide to extend your SlidingDrawer, say if you wish to allow it to set its height to wrap_content

So, from my phone (API level 17) onwards SlidingDrawer is officially dead. Long live SlidingDrawer!

Standard
Random

Achoooo

I’m going to patent wipers for computer screens, hopefully automatically sensing moisture so I don’t have to get close.

Once I can think about auto-cleaning keyboards I’m patenting that too..

Standard
Android, Random, Rants

Ever since registering to Google Play to punt out a couple of simple apps I have been receiving some ads through the (developer registered) email address regarding advertising my apps to “drive higher revenue and get paid weekly”.

These apps, I may point out are free, so though I would *love* to get mo4r cash my development output at this stage isn’t exactly going to to buy me a house.

Fuck off AirPush – I hate your invasive advertising tactic and I hate finding your emails advertising yourselves. And the rest of the other guys eager to promote my apps – I’ll go find you if I wanted promotion. But somehow, I think I’ll take a flame thrower..

Not interested in dirty advertising, so fuck off with your ads

Aside