Can you say that again, Mr. Alarm?

While using my Hourglass app for Android phones, a user made an interesting observation:

Hi
I love this open source app and using it quite often. But sometimes my phone is in my pocket and I’m listening to music and I miss the time ended notification ! The vibration is short, easy to miss, same thing for the notifications sounds. I’d find “logical” to have a continuous notification that vibrates and rings until I manually stop it (from notification bar or inside app).
Is this feature planned for a future release ?
Thanks

What a great idea! I’m glad that “bruneton” opened this issue on my issue tracker. That’s part of the beauty of open source. Sure, closed source programs could take input as well, but the open source community encourages and enables it, as well as giving others the code so that they can make changes themselves!

So, I added another button:

time_up

And with that button, some new code, which you can check out in full from the commit on my GitLab, but here is the gist of it:

– // Cancel the notification.
 – mNotificationManager.cancel(0);

 – // Set the time bar back to usable.
 – timeBar.setEnabled(true);
 + if (alreYes) {
 +
 + startCount(2000,1000);
 +
 + } else {
 + // Cancel the notification.
 + mNotificationManager.cancel(0);
 +
 + // Set the time bar back to usable.
 + timeBar.setEnabled(true);
 + }

What we have here, is a repeating timer that, if the continuous alarm is set, will “repeat” by resetting the countdown to 2 seconds, over and over again, until you cancel the repeating alarm!

It seems to work well so far, but I think I can do better. So, I’m looking at adding a “Stop” or “Cancel” option to the notification pop up. We’ll see, but for now, it does repeat rather nicely!

Linux – keep it simple.

Advertisements

Putting Android Nougat on a Nook HD+

While there are several guides out there on how to do this, I ran into a slight snag while trying to put Android Nougat on a Nook HD+, so I thought I’d share that with you. I was following this guide: https://nookhdplusandroid7.wordpress.com/

Following through the instructions seemed to go very smoothly, until it didn’t work. Specifically, after putting in the micro SD card, and powering off the device, powering it on would just cause a blank screen. Then, several minutes later, the device would turn on as normal.

Turns out that the Nook just didn’t like my SD card. It was a 4 GB card that I had laying around. When I opened a new package of 16 GB PNY SD cards, the whole process started working.

I don’t want to rehash the excellent write up that was already given, but I thought I would share my small issue, in case someone else runs into that problem. Turns out, there are some newer roms available for the Nook HD+ as well.

Either way, here are a couple of screen shots about showing the outcome:

It seems to work rather nicely. I did notice one slight “glitch” to the screen when I selected MTP for the USB mode, but other than that, it seems to work great! Now I just have to force myself to give it back to it’s owner!

Linux – keep it simple.

C++ and variable screen sizes?

clouds

I’m at the end of section 3 of my online course, and I’ve learned so much! I’ll be honest, since Java and C++ are both object oriented languages, I feel that it has been a pretty smooth transition so far.

While not part of the course, I noticed when showing some friends my game, it didn’t look right on their screen. The problem was that the game is coded for a single screen size, and if they have a smaller screen, it doesn’t display properly. Some things are off the screen, or off center.

So, I remembered an old Android trick for similar issues, and started implementing it here. Rather than setting static sizes throughout the game, I set my code up like so:

int sWidth = 1024;

int sHeight = 786;

sf::RenderWindow window(sf::VideoMode(sWidth, sHeight), “Timber!”);

By making the objects variants of sWidth and sHeight, I can later poll the screen size and set the graphics to match. At least that is the plan. Right now I am just doing it manually, but rather than adjusting every line of code, I am just changing the sWidth/sHeigth lines.

You can check out the full commit, including adding text and time bars at my GitLab.

Linux  – keep it simple.

BlueFruit Project: All boxed in!

Spent a little bit of time with a soldering iron.

 

I put my project into a box, wired in all of the relays, and ran several feet of wire for connecting to the various functions. Hopefully this will work! I’m planning to do some heavy bench testing really soon.

schematic

This was my original  schematic. For the most part, I stuck with it, but I did make a few changes along the way. For one, I replaced the second analog input to be a digital input, just routing the brake lights to activate a relay which allows 3.3vdc to go to the input switch.

Another change was adding a parking lights relay, which is activated from the “key on” relay. I don’t have it hooked up in my box yet, but it is in place, just needs the power wire hooked to it. It wasn’t part of the original plan, so I am not implementing it yet. I don’t want to get too crazy before actually testing if it works.

It is going to be really fun to hook this up. I’ll have to crawl around under the dash of my truck and get these wires put in.

Linux – keep it simple.

Video Tutorial on How to Compile Android and Modify Kernels

video

For those interested, I have just posted a video tutorial series on XDA for building Android Oreo, Nougat, Marshmallow, and Lollipop on 5 different phones, the emulator, and 5 different ROMs. Also included are custom kernel editing, adding apps, changing source code, backgrounds, and more. Here’s what I posted:

From XDA: https://forum.xda-developers.com/android/general/guide-how-to-build-custom-roms-kernel-t3814251

===========================================================================

Praise God! Finally a video tutorial of how to build Android and modify kernels!

I have created a video tutorial and guide for how to compile Android, from Lollipop through Marshmallow, Nougat, and Oreo. The video series covers several different phones, the emulator, kernel and rom editing, app source code editing, and much more!

Who is this video series for?
Well, this video tutorial is a step by step guide built primarily for the beginner. This is written for those who already know how to flash TWRP, CWM, or the like, and who have installed a custom rom before. This is designed to help those who are ready to move up from flashing and installing other peoples custom rom to actually start making their own custom roms. I recommend that a beginner watch the entire series in numerical/alphabetical order (the videos are marked).

That said, I believe that an intermediate developer may find a useful trick here and there, and they should just skip ahead to videos of interest. Perhaps kernel development, or something along those lines.

An advanced rom/kernel developer will probably far exceed my feeble abilities, and will not likely find much useful information here. Perhaps if you are an advanced developer, you would consider continuing the tutorial or making an advanced video series! (See further posts for recommendations on contributing videos.)

Why did you put this together?
Well, after building roms for several different devices, I started receiving requests from users who wanted to start building their own roms, but didn’t know how. I didn’t have enough time to answer everyones questions, so I wrote a few guides, pointed others to guides that were available, but there are some things that you just need to see to understand. Hence, the video tutorial. I just hope that someone finds it useful.

This course was written in order! While Lollipop and Marshmallow are old by today’s standards, there is still good learning value in building them, and there are topics covered there that really make them worth watching.

What’s in the videos?
During the series, we will be building for the emulator, as well as 5 different phones of various brands, and 5 different roms. I hope that this will give the viewer a good idea of how to build for their own specific phone as they see the differences and similarities across the phones and custom roms.

[CODE]
+ Ubuntu installation
+ Java installations
+ Using Git, GitHub, GitKraken, and the command line
+ Fastboot and ADB
+ Heimdall/Odin
+ QFIL, QPST, SALT, and other tools
+ AOSP, SlimRoms, PACrom, AOKP, AOSCP
+ Lollipop, Marshmallow, Nougat, Oreo
+ Errors
+ Overclocking CPU/GPU
+ Adding Governors and I/O Schedulers
+ Sound modifications
+ Changing app colors, text, and icons
+ Adding prebuilt apps
+ Adding source code
+ Converting device from one rom to another
+ AND MORE!
[/CODE]

**** This is an UNOFFICIAL TUTORIAL. Use at your own risk! ****
Download links:
Ogg Vorbis Video GitLab:
[url]https://gitlab.com/alaskalinuxuser/course_android_developer_guide[/url]
Clicking on a video in GitLab will allow you to watch it online.

Ogg Vorbis Video Downloads:
[url]https://gitlab.com/alaskalinuxuser/course_android_developer_guide/-/archive/master/course_android_developer_guide-master.zip[/url]
This download is rather large due to the multiple videos.

MP4 Video GitLab:
[url]https://gitlab.com/alaskalinuxuser/course_android_developer_guide_mp4[/url]
Clicking on a video in GitLab will allow you to watch it online.

MP4 Video Downloads:
[url]https://gitlab.com/alaskalinuxuser/course_android_developer_guide_mp4/-/archive/master/course_android_developer_guide_mp4-master.zip[/url]
This download is rather large due to the multiple videos.

I also have several written guides available on XDA, here are a few:

Building ROMs for the Galaxy Note Edge: [url]https://forum.xda-developers.com/note-edge/general/guide-build-aosp-roms-kernels-note-edge-t3488840[/url]
Building ROMs for the Galaxy S4: [url]https://forum.xda-developers.com/galaxy-s4-tmobile/general/guide-step-step-instructions-building-t3402637[/url]

===========================================================================

Be sure to check out the videos or the XDA thread! I hope that these will help some of the aspiring Android developers out there!

Linux – keep it simple.

Randomness in C++

One of the most interesting things I’ve learned since completing the second section of my Udemy course on C++ game creation, is that of random number generation. In Android, this process was a little more straight forward, with everything behind the scene just being handled for you. You simply created a “random number generator” class and asked it for a random number within a range.

In C++, at least the way my instructor is teaching us, it is a bit different. It appears that you first need to “seed” the random number generator with some numbers. Here is what I learned:

// Seed our random number with time from system.

srand((int)time(0) * 10);

// Use the random to get a number between 0 and 199.

beeSpeed = ((rand() % 200) + 200);

// Now set the bee’s starting position.

srand((int)time(0) * 10);

float height = ((rand() % 700) + 100);

It is a little snippet from the commit with all the code to move bees and clouds on the screen.

So, if I understand correctly, you have to first seed the random number. From the instructor, an easy to grab item to seed it with that changes often is the time. So, we are seeding the random number generator with the time multiplied by a number of our choosing.

If you just used an static number, then I believe the returned random number will always be the same. By using the time, which continues to change, then you will grantee that you don’t get the same input seed, making a similar random return highly improbable.

cloud

Right now, the background includes a few moving clouds and a bee. Not much to see, but you are welcome to check it out at my GitLab.

Linux – keep it simple.

Finding apps for a ZTE Z432 dumb phone!

My wife and I recently picked up a dumb phone for things like hunting/camping/fishing. You can get them pretty cheap, and the battery life is fantastic compared to most smart phones. Besides, if you loose it, you’re only out a few bucks.

While a dumb phone is, well, dumb, we were hoping to spruce it up with a few apps for some entertainment value. Especially if you use it while traveling, like taking a plane or boat to some remote spot.

After some web searching, all I could come up with was that AT&T, who sells the ZTE Z432 phone, said that this phone did not support any apps. I recalled the yester-years spent using apps on dumb phones, and I knew this just couldn’t be true. So, if this is your plight, and you also failed to find the answer through a web search, then here you go:

http://www.dertz.in/games/p/download-ZTE-Z432-free-games-9720.htm

I want to be clear that I am in no way endorsing “Dertz”, and I can’t say that all of their apps are safe. In fact, this may be a sure fire way to nuke your dumb phone. However, I did download and install this one:

http://www.dertz.in/games/download-Scrabble-Remix-free-java-mobile-game-10824.htm

and it worked great! How can you go wrong with Scrabble Remix?

The easiest way to install them, is to open the link in the phone browser. Once there, scroll down to the download button, and click it. A pop up will ask you if you really want to download that jar file, and if you say yes, a progress bar will appear. Once downloaded, it will be in your folders.

Find the app you downloaded in your folders, and click on it. It will pop up an install question, and if you say yes, it will ask where to install the app, in either Applications, or Games. In my case, I chose Games. After a minute or so, the app was installed and a pop up asked me if I wanted to open it. Scrabble Remix – game on!

I also experimented with the Bluetooth, which works well. Just download the app you want on a smartphone, or in my case, a Bluetooth capable computer, pair with your Z432, and send the file over that way, if you want to save yourself from painful dumb phone browser experience, or save bandwidth.

For the record, we can just insert our normal sim card from our smart phone into the dumb phone, and it works, however, we did need a sim card holder, because our smart phones use micro sims, and the dumb phone used standard sim cards, but they make a little micro to standard holder that your sim card can pop in and out of. If you need one, stop by just about any cell phone dealer, they should have one.

Linux – keep it simple.

Adding a countdown timer to my Android notification….

This was actually a great idea brought up by a user, and posted in my issue tracker for the Hourglass app. He pointed out that it would be really handy to have the remaining time posted in the notification popup, and get it to be consistently updated.

I thought there must surely be something for this in Android already, but I couldn’t find one. However, I did find a chronometer that can count how long a notification has been open. With some careful thought, here is what I came up with:

NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
        .setSmallIcon(R.drawable.hourglass).setWhen(System.currentTimeMillis()+recureTime).setUsesChronometer(true)
        .setContentTitle("Hourglass").setContentText(intentPhrase);

What I found was that I could “back up” time to before the notification started. Essentially giving it a negative number. Then, passing the time saved for recurring alarms (even saved if not used), then I can set it to a negative of that number. Now it counts “up” from negative time, giving the appearance of counting down your timer!

timer_notification

Works pretty well, however, 2 interesting things. I would have thought the code should be MINUS recureTime, not PLUS recureTime, but it only works properly with PLUS.

Second, the “countdown timer” in the notification doesn’t track exactly with the Hourglass app timer. In the course of several minutes, it becomes off by a second. Odd, but workable. The timer still goes off in the app on time, just that the countdown in the notification may get there a second early.

Linux – keep it simple.

Custom script to build my C++ games

So, I’ve completed section one of my Udemy course. There are eleven sections total. It’s a bit odd, in that the course instructor is using Microsoft Visual Studio, and I am not. Actually, I’m not even using Windows. So there are a few differences that I think are worth noting.

One of the biggest differences, is when he is done adding something, or doing something, he simply presses a debug/play button at the top, and his newfangled app launches. Now, there are several options for good Linux IDE’s to do this sort of thing, but I’m a bit of a minimalist myself, and I feel it helps me learn more as well, so I’ve been using Geany to type out and build the programs.

sfml_timber_1

Geany works great, is lightweight, has a compile and run button, and text color coding specific to whichever language you are working in. To be honest, I couldn’t be happier with the experience. At present, however, I need to link the SFML files to my compiled code to run the game. There are ways to do this in Geany, but I wrote a simple script that does everything for me instead:

#!/bin/bash

# You need libsfml installed on your system!

g++ -c Timber.cpp
g++ Timber.o -o timber-app -lsfml-graphics -lsfml-window -lsfml-system

./timber-app

echo “type ./timber-app to launch”
exit

I call it build.sh. After I’m done coding, and I’m ready to try my game, I just double click on the build.sh script, and it compiles, links, and launches my game. Pretty easy! So far, I’m working through a tree cutting game called “Timber”. You can check it out on my GitLab if you’d like. Just remember, if you download the files, you must install libsfml before running the build.sh script.

Linux – keep it simple.

Using A NetGear AC600 (A6100) With Linux Successfully!

Due to a few changes at work, I was in need of an USB WiFi adapter for my desktop computer. Of course, I’m running Linux, and while that shouldn’t make things complicated, when it comes to hardware, sometimes it does.

There are tons of great WiFi adapters that work great out of the box with Linux. There are even numerous Open Source, and some Open Hardware versions too. However, in Alaska, you typically have to order out for something like that. Instead, I needed a WiFi adapter today, not in the mail.

A quick run to a local “buy your groceries and everything else” (Jack of all trades, master of none) store provided me with few options. However, a quick web search proved that the AC600 (model A6100) USB adapter was working for others on Linux, so I picked that up.

41WBoY-N-0L._SL160_

Unfortunately, my first web search led me to source code which I downloaded and compiled, but it did not work. Apparently there are more than one generation with the same model number, and those drivers didn’t help me. However, further search lead me here: https://wikidevi.com/wiki/Netgear_A6100, which lead me here: https://github.com/abperiasamy/rtl8812AU_8821AU_linux .

I don’t want to rehash the already great instructions provided, so you can read that page for the full details, but here is my history from my terminal:

2015 git clone https://github.com/abperiasamy/rtl8812AU_8821AU_linux
2016 cd rtl8812AU_8821AU_linux/
2017 make
2018 sudo make install
2019 sudo modprobe -r 8812au
2020 sudo modprobe -a rtl8812au
2021 sudo iwconfig
2022 history
2023 sudo nano /etc/modules
2024 sudo apt-get update
2025 sudo apt-get install dkms
2026 sudo cp -R . /usr/src/rtl8812AU_8821AU_linux-1.0
2027 sudo dkms add -m rtl8812AU_8821AU_linux -v 1.0
2028 sudo dkms build -m rtl8812AU_8821AU_linux -v 1.0
2029 sudo dkms install -m rtl8812AU_8821AU_linux -v 1.0

Long story short: If you follow the instructions, you will have this installed in under 15 minutes, and it does work! So, if you happen to have one of these, or need to use one on Linux, it is fairly simple and does function great!

Linux – keep it simple.