Sunday, April 16, 2017

Game maker Android plugin, getting application context

Game maker Android plugin java code,

Application Context is available as part of RunnerJNILib that you normally include

Sample code accessing context below

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
package ${YYAndroidPackageName};

import android.content.Context;
import android.app.Application;

import ${YYAndroidPackageName}.R;
import com.yoyogames.runner.RunnerJNILib;

public class MyClassName {
 private Context mContext;
 public  MyClassName() {
  mContext = RunnerJNILib.GetApplicationContext();
 }
}

Sunday, March 19, 2017

Gamemaker 1.4 android publishing for IAP requires read_phone_state permission

When you add in app purchasing, and start using "Google Play Licensing" you will notice that the app now requires read_phone_state, which do not look good on app installs

To remove read_phone_state from the android apk please do below


  1. Goto YourProject.gmx\extensions\GooglePlayLicensingAsExt\AndroidSource\Sdk\library
  2. Edit AndroidManifest.xml
  3. Add xmlns:tools="http://schemas.android.com/tools" to manifest header
  4. Add <uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove" /> in the body
  5. Save and compile project
The file in the end will look like below -->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.vending.licensing"
xmlns:tools="http://schemas.android.com/tools"
android:versionCode="2"
android:versionName="1.5">
<!-- Devices >= 3 have version of Android Market that supports licensing. -->
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="15" />
<!-- Required permission to check licensing. -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove" />
<uses-permission android:name="com.android.vending.CHECK_LICENSE" />
</manifest>


Tuesday, January 24, 2017

Connect Visual Studio code to github

First go to github and locate the project you are going to work on.
Copy the URL of the project, for example https://github.com/myuser/myproject.git

now, in your laptop, go to command prompt, and the folder you want to check out and work on the project

lets say
c:\projects\

Create your project folder myproject

go to myproject
now your command line should be on
c:\projects\myproject

To get the project locally (from github), run first
git init
and then
git clone https://github.com/myuser/myproject.git
on the command line
that's all to it. Now we can close the command line

Open up Visual Studio code and open folder c:\projects\myproject
You can now start making changes to your project and also check in checkout from VS Code itself. Look for Git on the tab on left (third button down)

Sunday, January 1, 2017

Serif PagePlus, merging multiple documents (.ppp) together into one (single) document

Say you have two or more Serif PagePlus (*.ppp) files and want to merge them together into one file. You can accomplish this with the below steps

1. Open the first document in PagePlus (this will be your final merged document)
2. Go to the last page in the document
3. From menu option choose, Insert and then Publication
4. Select your second document and click Open
5. Select option "After the current page" and click OK
6. Repeat steps 2 to 5 as much as you need (ie; for all your rest of the docuuemnts that need merging)
7. Use File, Save As option to Save the new merged document to disk




Sunday, September 4, 2016

Cordova add local notifications with default sound



1. add plugin Local-Notification
cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications

2. To test a sample, In onDeviceReady, add below. This will show the notification after about a minute after you launch your app. You can close the app or minimize it (ie; go launch another app or go to home page)


        var date = new Date();
        date = new Date(date.getTime() + 1 * 60000) // add a minute from now

        cordova.plugins.notification.local.schedule({
            id: 1,
            title: "My Notification Title",
            message: "My Notification Body",
            at: date,
            sound: "res://platform_default"
        });

Android emulator add ringtone and notification sounds

The default android emulator do not come with any sounds, like ringtones or notification sounds. You can check this by going to the settings --> Sound option and see whats set for ringtone or notifications. By default, this will be set as None.

To add sounds locate mp3 file(s) you want to use and put it into a folder, for example create a  folder sounds and copy the file(s) there. you can download some from www.freesound.org if needed

Run the AVD (Android Virtual Device) manager and click edit on the AVD name you want to use. Make sure SD card option is selected and a size is provided.  About 100MB will be more than enough. Click OK to and close.

Now fire up the emulator ( by clicking start in AVD manager) and once its running, come to the command prompt. Assuming you have android tools in your path (ex: "C:\Program Files (x86)\Android\android-sdk\platform-tools\") , issue below command
adb devices

If all is well, it should show the emulator device details we are connecting to.
for example

C:\>"C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe" devices
List of devices attached
emulator-5554   device

Make a note of the below folders

SD-Card
/mnt/sdcard/alarms
/mnt/sdcard/notifications
/mnt/sdcard/ringtones

Form commands like below to copy the mp3 files to your emulator where sounds is the folder where you have stored your local copy of mp3 files to be copied

C:\Users\myname\Downloads>adb push sounds /mnt/sdcard/ringtones
push: sounds/ding.mp3 -> /mnt/sdcard/ringtones/ding.mp3
1 file pushed. 0 files skipped.
584 KB/s (24912 bytes in 0.041s)

C:\Users\myname\Downloads>adb push sounds /mnt/sdcard/notifications
push: sounds/ding.mp3 -> /mnt/sdcard/notifications/ding.mp3
1 file pushed. 0 files skipped.
619 KB/s (24912 bytes in 0.039s)

Now restart your emulator, and the sounds should show up in setting. You can select the appropriate sounds now!

You may even skip the SD card and directly copy to the system folders (I haven't tested this)
Android OS System
/system/media/audio/alarms
/system/media/audio/notifications
/system/media/audio/ringtones

Wednesday, August 10, 2016

Visual studio message - Your license has gone stale and must be updated

Running Visual Studio 2015 on Windows 2012 R2, and suddenly a popup came saying "Your license has gone stale and must be updated"

Clicking the update licence gave an error download of licence failed. Sign out and sign in also did not work. The only other option was to exit visual studio, and that's not very helpful at all.

After numerous google searches, figured that the issue is about UAC. To solve, I followed the below steps

1. Go to Control Panel
2. Search UAC
3. Click on Action Center, Change User Account Control Settings
4. Make a note of the current slider setting
5. Turn the slider all the way to the bottom (ie; Never notify option) and click OK
6. Go back to visual studio and check the update license, and voila, the licence updated
7. Revert UAC original setting by going back to UAC and apply the original value (Step 4)

Turn on Windows 11 Fast Boot

If windows starting is slow, to enable windows 11 fast startup/boot,  Press Windows + R, type powercfg.cpl, and hit Enter.  This will direct...