Android SSL and Wif Security in Marshmallow 6.0

BoringSSL


Android is moving away from OpenSSL to the BoringSSL library. If you’re using the Android NDK in your app, don’t link against cryptographic libraries that are not a part of the NDK API, such as libcrypto.so and libssl.so. These libraries are not public APIs, and may change or break without notice across releases and devices. In addition, you may expose yourself to security vulnerabilities. Instead, modify your native code to call the Java cryptography APIs via JNI or to statically link against a cryptography library of your choice.

Access to Hardware Identifier


To provide users with greater data protection, starting in this release, Android removes programmatic access to the device’s local hardware identifier for apps using the Wi-Fi and Bluetooth APIs. The WifiInfo.getMacAddress() and the BluetoothAdapter.getAddress() methods now return a constant value of 02:00:00:00:00:00.

To access the hardware identifiers of nearby external devices via Bluetooth and Wi-Fi scans, your app must now have the ACCESS_FINE_LOCATION orACCESS_COARSE_LOCATION permissions:

Note: When a device running Android 6.0 (API level 23) initiates a background Wi-Fi or Bluetooth scan, the operation is visible to external devices as originating from a randomized MAC address.

 

 

https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html?hl=ja#behavior-notifications

 

 

Using Genymotion android emulator with Meteor

This is very important.

Cordova sees emulators as real devices so any commands you use must be as though you are connecting to a physical device.

This command will load your android app into your Genymotion instance and point it to your local IP. (substitute your own LAN IP in your case).

meteor run android-device –mobile-server=http://192.168.1.x:3000

OR

meteor run android-device

Running multiple instances

Initially you may only have one instance running at a time.To work around this minor limitation you can load your app on many emulated instances and then turn them all on concurrently to simulate multiple cordova users.

Within your meteor project root directory using this command line to deploy more instances:

.meteor/local/cordova-build/platforms/android/cordova/run

This will install the compiled app onto the device that is connected. Repeat for each device.

Then you can run a development instance of meteor with a mobile-server that all the clients will be connected.

Whenever you want to test, open up  your instances and fire up a meteor server instance.

meteor run android-device

Tips on running more than one emulator concurrently:

https://github.com/meteor/mobile-packages/issues/55

Troubleshooting:

Ensure you have USB debugging enabled

Ensure that you can connect to your instance using ADB

Ensure that you your device shows up as connected via ADB, check with ‘adb devices’ and ‘adb connect IP’

Ensure that you are using the latest version of ADB 1.0.32 (verify with ‘adb version’ in command line)

Ensure that you have configured Genymotion to use the same ADB as your system instance.

Other reading:

http://stackoverflow.com/questions/26918902/stuck-on-meteor-example-todos-loading-screen-when-running-on-an-android-device

Adding Google Apps (gapps) to Genymotion 2.6 +

Follow this instructional video.

https://www.youtube.com/watch?v=Jbu8WT-naW4

Grab the Gapps signed packages here

https://androidmtk.com/download-gapps

Tested April 2016

 

Alt solution, (untested)

1) genymotion 2.6.0
2) device emulator PREVIEW – Google Nexus 5X – 6.0.0 – API 23 – 1080×1920
3) flash Genymotion-ARM-Translation_v1.1.zip then restart.
4) flash gapps-L-4-21-15.zip. (https://www.androidfilehost.com/?fid=96042739161891406)
5) sign in into your google account.
6) flash ( benzo-gapps-M-20151011-signed-chroma-r3.zip) https://www.androidfilehost.com/?fid=24052804347835438 and restart.

 

Alt solution, tested

  1. Install a latest Genymotion (version 2.6.0 in my case). Make sure the previous old (preview) Android 6.0 images are removed (Genymotion -> Settings -> Misc -> Clear cache).
  2. Add a new virtual device, select Google Nexus 5X and Android 6.0 image. It should download a new image from Genymotion website.
  3. Start created Google Nexus 5X – 6.0.0 – API 23 – 1080×1920 virtual device.
  4. Flash Genymotion-ARM-Translation_v1.1.zip (drag&drop the zip file to virtual device window) and then restart the virtual device.
  5. Flash gapps-L-4-21-15.zip and restart the virtual device again.
  6. Now add Google account in the virtual device via Settings -> Accounts -> Add account. 
  7. Do not start Google Play! Ignore any crashes in sign in process.
  8. Flash benzo-gapps-M-20151011-signed-chroma-r3.zip and restart the virtual device.
  9. Open Google Play in virtual device, update all installed applications.
  10. Now the device is prepared with working Google Play and Google Play Services.

 

Alt downloads for Gapps

http://androiding.how/android-6-0-marshmallow-gapps/

 

Notes: It seems you cannot use the open_gapps packages as they are not signed. Perhaps there’s a workaround but the method above works out of the box.

References:

https://gist.github.com/wbroek/9321145

 

Android, Androidx86 Virtualbox, adb, Chrome Inspector

Use a bridged connection and follow this short guide

Android Debugging with VirtualBox & Androidx86

Androidx86 install guide (http://visualgdb.com/tutorials/android/virtualbox/)

Connecting

To connect Android virtual machine with adb follow these step

  1. On Android home screen, press ALT+F1 (Left alt). This will open a terminal with root access.

  2. Inside the terminal, type dhcpcd eth0. Execute the command twice, if you get an error or no result. This will give you an IP address. Now press ALT+F7 for close the terminal.

  3. Verify your IP address using the command ping <your IP Address>

  4. From the android terminal, type adb tcpip 5555. This will restart adb in tcpip mode.

  5. From your main OS terminal, type adb connect <your IP address>

http://stackoverflow.com/questions/12260257/adb-unable-to-connect-to-android-x86-in-virtualbox-today

http://www.android-x86.org/documents/debug-howto

 

 

Troubleshooting

Try these steps if you encounter any connection issues.

adb kill-server

sudo adb tcpip 5555

adb connect 192.168.207.1

http://stackoverflow.com/questions/18930050/adb-connection-over-tcp-not-working-now

Android Drawables

How it works

http://developer.android.com/guide/topics/resources/drawable-resource.html

https://github.com/katzer/cordova-plugin-local-notifications/wiki/10.-URIs

 

What are the drawable assets that can be replaced

http://developer.android.com/reference/android/R.drawable.html

http://androiddrawables.com/

 

What is the problem we are solving

http://stackoverflow.com/questions/13847297/notificationcompat-4-1-setsmallicon-and-setlargeicon

http://stackoverflow.com/questions/27188689/why-do-icons-set-with-notification-builder-setsmallicon-in-android-lollipop-show

https://github.com/katzer/cordova-plugin-local-notifications/issues/890

https://github.com/raix/push/issues/132

 

What do to

http://stackoverflow.com/questions/2533410/drawable-folders-in-res-folder

 

How to solve the problem efficiently

https://romannurik.github.io/AndroidAssetStudio/index.html

http://developer.android.com/guide/topics/resources/providing-resources.html

 

Meteor cordova integration notes

https://github.com/meteor/meteor/wiki/Meteor-Cordova-integration

 

Sometimes you might need to override parts of the Cordova project that Meteor generates for you in the project/.meteor/local/cordova-build directory. For example, you might need to add some files to the build process in an ad-hoc way.

For these and other advanced purposes we have created a special top-level folder calledcordova-build-override. The whole file tree of this directory will be cp -R (copied overwriting existing files) to the Cordova project right before the build and compilation step.

For example: if you want to have a customized config.xml, you can put it in project/cordova-build-override/config.xml.

 

 

Best place to install , and how to install Android SDK for OSX MAC

 

The easiest way to install Android SDK under OS X is to use brew.

brew install android-sdk

 After installation,

Now run the ‘android’ tool to install the actual SDK stuff.

 

 

The Android-SDK location for IDEs such as Eclipse, IntelliJ etc is:

  /usr/local/Cellar/android-sdk/23.0.2

 

 

You will have to install the platform-tools and docs EVERY time this formula

updates. If you want to try and fix this then see the comment in this formula.

 

You may need to add the following to your .bashrc:

  export ANDROID_HOME=/usr/local/opt/android-sdk

 

Creds:

https://stackoverflow.com/questions/2677431/where-to-install-android-sdk-on-mac-os-x