Tuesday, December 6, 2016

Android 7.1 Nougat on Nexus 7 2012 WiFi

  1. Backup / transfer personal data (texts, photos, videos, apps, etc)

  2. Read [ROM][7.1.0_r5][NDE63U][Grouper|Tilapia][F2FS/EXT4]Android 7.x AOSP by AndDiSa
    • download aosp_grouper-7.1-ota-eng-20161127.ds.zip (219 MB)
    • check MD5 signature (FCIV or a similar tool):
      fciv -add aosp_grouper-7.1-ota-eng-20161127.ds.zip -md5
  3. Install Android SDK / platform-tools

  4. Install TWRP (Team Win Recovery Project) for Nexus 7 2012 Wifi
    (twrp-3.0.2-0-grouper.img, 2016-04-04, 93 MB)

    Follow Fastboot Install Method (No Root Required) section.

  5.  Boot into recovery mode (TWRP) with:
    adb reboot-bootloader
    Use Volume Up or Down keys to select "Recovery Mode", then press "Power".

  6. Now in TWRP, choose Wipe > Swipe to fatory reset

  7. Back to TWRP main screen > Advanced > ADB Sideload > Swipe to Start Sideload

  8. Sideload new ROM from your PC:
    adb sideload aosp_grouper-7.1-ota-eng-20161127.ds.zip
    Total xfer: 1.00x

    Note:  E: unknown error [log] causes or implications are yet unknown, ignoring for now.

  9. Go to Open GApps, choose ARM + Android 7.1  + Pico.
    • download open_gapps-arm-7.1-pico-20161205.zip, 5 December 2016, 121 MB
    • check MD5 signature (FCIV or a similar tool):
      fciv -add aosp_grouper-7.1-ota-eng-20161127.ds.zip -md5
  10. Sideload Open GApps:
    • go back and reselect Sideload option
    • select Wipe Dalvik Cach
    • Swipe to Start Sideload
    adb sideload open_gapps-arm-7.1-pico-20161205.zip
    Total xfer: 1.19x

  11. Reboot (TWRP Main > Reboot > System).

Wednesday, November 16, 2016

Windows 10 Anniversary Update on ASUS R2H - "End of the Road"

    I remember I started this blog almost exactly 10 years ago all excited by the advent of mini-tablets in the form or UMPCs, with a first post from the actual device.

    My ASUS R2H came with Windows XP Tablet Edition, qualifying for a free upgrade to Windows Vista, followed by quite a number of pre-release, preview, trial and final versions of Windows 7, Windows 8 and 8.1, and finally Windows 10. In spite of the fact that the actual support from ASUS and Intel ended with Windows Vista, it has been possible to run for much longer thanks to Windows support for legacy devices from Microsoft.

    It is finally time to declare End of the Road for Windows with so appropriately release named: Windows 10 Anniversay Update (version 1607, build 14393.447)

    ASUS R2H-BG059T

    Windows 10 Anniversary Update
    version 1607, build 14393.447

     ➤  Graphics 

           Graphics performance of the old Intel GMA 900 is quite poor with Microsoft Basic Display Adapter driver (v10.0.14393.0, 21 Jun 2006).

           ASUS graphics driver for Windows Vista (v6.14.10.4764, 15 Mar 2007) will not install anymore, XPDM (XP Display Model) drivers are not supported starting with Windows 8.

    ➤  Touch screen

          Calibrate using Digitiser Calibration Tool (tabcal.exe)

    ➤  Audio

          ASUS audio driver for Windows Vista (v6.10.1.6030, 15 Mar 2007)

    ➤  Webcam

         ASUS camera driver for Windows Vista (for Bison v6., 10 Sep 2007 or otherwise choose your own from the driver download page)

    ➤  Thumbstick

         ASUS touchpad driver for Windows Vista (v9.1.5.0, 25 Jan 2007)

    ➤  Fingerprint

           Works fine with Windows (AuthenTec) driver (v3.4.4.84, 11 Oct 2012). Enrol your fingerprint(s) in Settings > Accounts > Sign-In Options. Fingerprint Set Up button might be disabled if you haven't configured a text password yet - should do that first and then come back to it.


    ➤  Bluetooth

         Works fine with generic Microsoft driver (10.0.14393.351, 21 Jun 2006). ASUS Bluetooth driver for Windows Vista (v5.10.02, 12 Feb 2007) would not install.


    ➤  WiFi

         Works with Windows (Atheros) provided driver (v2.2.0.27, 29 Jul 2008). You can install ASUS Wireless driver for Windows Vista (v2.0.0.130, 17 Aug 2007) but after installing ASUS Wireless Console (v2.0.8, 7 Mar 2007)


    ➤  Ethernet

         Works with Windows (Realtek) provided driver (v10.9.422.2016, 22 Apr 2016). You may try to install the ASUS LAN driver for Windows Vista (V6.190.115.2007, 24 Jul 2007).

    ➤  GPS

         Enable GPS receiver (NMEA 0183 on COM1, 4800 baud) with device_switch.exe part of ASUS Device Switch (v1.0.0.1, 25 Jul 2007) or the open source eqivalent gpsCtrl.exe (dandar3/ASUS-R2H-gpsCtrl on GitHub).

    Tested with GPSDirect (Sensor Driver > Install, followed by Tests > Sensor Explorer On) and MTTTY Serial Terminal (COM1, 4800, 8-N-1, followed by File > Connect).

      Saturday, November 5, 2016

      Eclipse: Integrate Firebase Analytics into your Android app

      With official support moving away from Eclipse towards Android Studio and Gradle, new things like Firebase Analytics have become unavailable to developers wanting to continue using Eclipse for their app development. In this post, I will go through the libraries and the configuration required so you can integrate it in your Eclipse project.

      Firebase Analytics libraries


      dandar3/android-google-firebase-README project (GitHub) gives you an overview of the available Firebase libraires ready to use with your Eclipse project. Have a look at the two YouTube videos at the end covering the installation of the Subversive plugin and the steps to easily import an entire project set like Firebase Analytics into your workspace.

      You will observe compile errors like Tag ... attribute name has invalid character '$' after importing libraries like android-google-firebase-iid or android-google-firebase-common. To resolve the issue you will have to manually replace ${applicationId} with your application id (Java package) in all AndroidManifest.xml files (use CTRL+H > File Search >  Replace...

      Importing google-services.json


      There is no Eclipse plugin to do the work that the Google Services Gradle plugin does for Android Studio (I have started working on one, but I can't say when this will be available), so you would have to read the Firebase documentation and follow the Processing the JSON File information to manually create your own values.xml.

      If you're having trouble with getting this right you could use Android Studio to import firebase/quickstart-android GitHub project, deploy your google-services.json into it and then copy the generated values.xml out.

      <?xml version="1.0" encoding="utf-8"?>
          <string name="default_web_client_id" translatable="false">{YOUR_CLIENT}/oauth_client/[first client_type 3]</string>
          <string name="gcm_defaultSenderId"   translatable="false">project_info/project_number</string>
          <string name="firebase_database_url" translatable="false">project_info/firebase_url</string>
          <string name="google_app_id"         translatable="false">{YOUR_CLIENT}/client_info/mobilesdk_app_id</string>
          <string name="google_api_key"        translatable="false">{YOUR_CLIENT}/services/api_key/current_key</string>
          <string name="google_storage_bucket" translatable="false">project_info/storage_bucket</string>

      AndroidManifest.xml changes

      This is the undocumented part that can only be observed by looking at the AndroidManifest.xml generated by Google Services Gradle plugin (app\intermediates\manifests\full\debug\AndroidManifest.xml).
      <?xml version="1.0" encoding="utf-8"?>
          <!-- Required permission for App measurement to run. -->
          <uses-permission android:name="android.permission.INTERNET" />
          <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
          <uses-permission android:name="android.permission.WAKE_LOCK" />
          <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
              android:protectionLevel="signature" />
          <uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" /> 
                  android:exported="false" >
                  android:permission="android.permission.INSTALL_PACKAGES" >
                      <action android:name="com.android.vending.INSTALL_REFERRER" />
                  android:exported="false" />
                  android:value="@integer/google_play_services_version" />
                  android:initOrder="100" />
                  android:permission="com.google.android.c2dm.permission.SEND" >
                      <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                      <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
                      <category android:name="${applicationId}" />
                  Internal (not exported) receiver used by the app to start its own exported services
                  without risk of being spoofed.
                  android:exported="false" /> 
                  FirebaseInstanceIdService performs security checks at runtime,
                  no need for explicit permissions despite exported="true"
                  android:exported="true" >
                  <intent-filter android:priority="-500" >
                      <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />

      Without these changes you would get all sorts of errors in logcat when running your app, some of them listed  below:
      11-04 15:56:22.970 E/FA      ( 1539): AppMeasurementReceiver not registered/enabled
      11-04 15:56:22.971 E/FA      ( 1539): AppMeasurementService not registered/enabled
      11-04 16:01:23.188 W/FA      ( 1694): Failed to retrieve Firebase Instance Id
      11-04 16:01:36.391 E AndroidRuntime: Process: com.google.firebase.quickstart.analytics, PID: 1718
      11-04 16:01:36.391 E AndroidRuntime: java.lang.RuntimeException: Unable to start receiver com.google.android.gms.measurement.AppMeasurementReceiver: 
                                           java.lang.SecurityException: Neither user 10067 nor current process has android.permission.WAKE_LOCK.



      Enable verbose / debug logging for Firebase Analytics (docs):
      adb logcat -c 
      adb shell setprop log.tag.FA VERBOSE
      adb shell setprop log.tag.FA-SVC VERBOSE
      adb logcat -v time -s FA FA-SVC

      If everything looks fine you may notice the upload scheduling is nothing close to Google Analytics (1h to 12h) - Steve Ganem, Product Manager at Firebase Analytics, confirms on StackOverflow he is aware of the need for quicker reporting.
      11-05 21:01:21.560 V/FA      ( 1418): Upload scheduled in approximately ms: 3599998

      One way to trigger the initial upload found by Yapaxi user on the same thread, is to Clear data for your app. That will not make the information immediately on the Firebase Console web app, it could take up to an hour or more before the reports are made available.
      --------- beginning of system
      --------- beginning of main
      11-05 21:25:17.413 I/FA      ( 1761): App measurement is starting up, version: 9877
      11-05 21:25:17.413 I/FA      ( 1761): To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
      11-05 21:25:17.413 D/FA      ( 1761): Debug-level message logging enabled
      11-05 21:25:17.413 D/FA      ( 1761): AppMeasurement singleton hash: 96720111
      11-05 21:25:17.418 V/FA      ( 1761): Collection enabled
      11-05 21:25:17.418 V/FA      ( 1761): App package, google app id: com.google.firebase.quickstart.analytics, 1:348775509088:android:a9b2141120408d37
      11-05 21:25:27.931 V/FA      ( 1761): Uploading data. app, uncompressed size, data: com.google.firebase.quickstart.analytics, 445,
      11-05 21:25:27.931 V/FA      ( 1761): batch {
      11-05 21:25:27.931 V/FA      ( 1761):   bundle {
      11-05 21:25:27.931 V/FA      ( 1761):     protocol_version: 1
      11-05 21:25:27.931 V/FA      ( 1761):     platform: android
      11-05 21:25:27.931 V/FA      ( 1761):     gmp_version: 9877
      11-05 21:25:27.931 V/FA      ( 1761):     uploading_gmp_version: 9877
      11-05 21:25:27.931 V/FA      ( 1761):     config_version: 1477992761690000
      11-05 21:25:27.931 V/FA      ( 1761):     gmp_app_id: 1:348775509088:android:a9b2141120408d37
      11-05 21:25:27.931 V/FA      ( 1761):     app_id: com.google.firebase.quickstart.analytics
      11-05 21:25:27.931 V/FA      ( 1761):   }
      11-05 21:25:27.931 V/FA      ( 1761): }
      11-05 21:25:27.931 V/FA      ( 1761): Uploading data. size: 431
      11-05 21:25:28.039 V/FA      ( 1761): Upload scheduled in approximately ms: 3599999
      11-05 21:25:28.042 V/FA      ( 1761): Successful upload. Got network response. code, size: 204, 0

      That's it - check your data up on Firebase Console an hour or so later.

      Friday, September 30, 2016

      How to import Android libraries from GitHub/dandar3 into Eclipse workspace

      Showing you today an easier way of importing Android Support and Google Play Services libraries for Android from github.com/dandar3 repositories into your Eclipse workspace.


      Navigate to:

      Choose the project you want to import (e.g. android-support-v7-appcompat).

      Scroll down to SVN Checkout section, right-click the Team Project Set URL and choose Copy link to copy it to clipboard.

      Switch to Eclipse then navigate to File > Import > Team > Team Project Set.

      Paste the address into the URL field (if not already pre-populated from clipboard), then click Finish.

      The download (import) may take a short while dependening on your Internet connection.

      Once finished, wait for Eclipse to rebuild all projects or manually choose Project > Clean > Clean all projects and check the Start a build immediately both with Build the entire workspace option.

      Then you can add the library (or libraries) as a dependency to your application.

      Tuesday, September 6, 2016

      Eclipse: Setting "derived" folders - AutoDeriv plugin

      Using Eclipse with Java or Android projects you may notice that "Open Resource" (CTRL+SHIFT+R on Windows) is showing files from bin (or gen or other) folders, that were copied or generated by the build process, that you really don't want to edit as they will get overwritten on next build, resulting only in frustration and wasted time if you do.

      Eclipse documentation for Derived resources:
      Many resources get created in the course of translating, compiling, copying, or otherwise processing files that the user creates and edits. Derived resources are resources that are not original data, and can be recreated from their source files.  It is common for derived files to be excluded from certain kinds of processing.
      You can manually update derived the flag on each resource in Properties page but as the resource will not be persisted in a source repository the flag won't as well. So that when you are checking out or downloading the project it will not be set, or when manually removing and recreating the particular resource in the case of a folder.

      AutoDeriv plugin comes to help as it relies on configuration stored in a .derived file in your project that can be commited in a source repository. When the project is created the plugin will automatically mark as derived the resources matched in the configuration file.

      The plugin also has a preferences page where you can change certain things like presentation.