This is how and what I used for people that have the same problem.
- Firstly I have installed busybox (Seems I needed this to do install as both pm and adb calls didnt work)
Install Terminal Emulator (So I could check commands worked and using chmod on phone)
Run Terminal and type su -s
Now that the Terminal shows # instead of $ I can now give permission to what I need to do my install.
Now from my app I can call install using busybox.
Runtime.getRuntime().exec("/system/bin/busybox install " + ToInstall.getAbsolutePath() + " /system/app");
In my case the ToInstall is a file I have located from a device.
Note:
This installs weirdly I have to use the following to remove
rm /system/app/AppName
Also its looks weird but doesn't matter as I won't have a screen
Permission on busy box path may need to be set in order for this to work. I can do this from the terminal in su mode. 702 is said to work although I used 777 as not worried about security.
chmod 702 system/bin/busybox