[MTCB Software Development] p_mike83:
After a lot of work I am presenting you my app to do the following: modeswitch / Spotify Control from SWC, voice dial using Google now.

Requirements:

1. Huifei type (MTCB) head unit

2. Root access

3. Mtc-keys module (thanks MVG-V70)

4. Android 4.4+ Rom

5. For Voice Dialing using Google Now:

a. Headunit service ( thanks Petrows)

b. True contacts app( download inside headunit service), and enter your contacts manually/ sync with Google account ,transfer or restore from phone

Features:

1. acts as HW- SWC-Modeswitch ( radio, music, DVD, Spotify, 2 custom apps)

2. Respects audio Focus of the currently active app. Opening one app mutes/kills audio coming from other apps. (Works for Radio, Music, DVD, Spotify regardless how was the app started, for the two custom apps works only if they are started through mode-Button). (To be fixed in Version 2.1)

3. Control Spotify using next/previous of the steering wheel buttons , regardless how spotify was opened.

4. Disable DVD/ Music/ Spotify in the mode circle.

5. Navigation monitor: If this option is activated, the screen returns in your preferred Navi-App after switching the Mode, if the navi app was already running. Select which Navi-App you are using, or add the package name of the app manualy.

6. it starts playing music automatically in Spotify

7. for devices lacking HW Modeswitch button: either you map an other button as Modeswitch or it can run as sw modeswitch ( as of now the latter will brake the spotify control functionality-- will try to fix it later)

8. Act as a bridge between headunit service from Petrows and Google now to do voice dialing.

Installation:

1. Install and activate MTC-keys ( see its threat for details)

2. Install and activate headunit service from Petrows, inside the app settings activate call from android and install true contacts app.

3. Sync or add contacts to the true contacts app

4. Reboot device

5. Install my app and run it

6. Give Root access to the app when you will ask to

Setup

On the first app launch, it opens app settings with following options:

A. Select to include DVD, Spotify, Music in the mode app list. Add until 2 custom apps if you want.

B. Activate software Modeswitch (if its activated, running the app from app drawer will change the mode)

C. Enter the SWC button code of the Modeswitch button ( default is 2, you can map any other button as well)

D. Choose to monitor your navigation, choose one option or enter navi app package manually

E. Activate or disable voice dialing

F. SAVE SETTINGS

TO OPEN SETTINGS AGAIN ONCE THE SETTINGS ARE SET DELETE APP DATA (ANDROID SETTINGS->APPS->MODESWITCH->Clear DATA) and rerun the app.

6. ONLY IF YOU HAVE A MODESWITCH BUTTON OR WANT TO MAP AN OTHER ONE BUTTON TO ACT AS MODESWITCH:

edit mtc-keys.ini and add this line:

app_XX = com.myapp.modeswitch

XX is the value of modeswitch button code you entered in my app settings, default is 2

How it works:

1, To change mode, just press the modeswitch button (or run the application if you selected software mode in the settings)

2, To make a call: open google now, and say : call "contact name"

Bugs:

1. there is a nag screen if you do a voice call (mobile network is not available) but it doesn't affect the app, so for now it left there.

2. You tell me....

Thanks to:

Petrows (headunit service)

MVG-V70 for MTC-Keys [MENTION=1298639]talalalal[/MENTION] for the voice dialing

and everyone that helped me

Download:

V1.01

https://mega.nz/#!Z4Bx1JKb!cUB5nxKK2QWpwIKClmsaSf5uDCbDeGm7XuYMqeXJkTc

V1.2

https://mega.nz/#!MpwzGZrA!upUXORZoG0b2PtnNVQwfR1Phr8rYBH1W7er2XqLHing

Version 2.0:

Download link:

https://mega.nz/#!FtwFWDDR!Ln1d4TueuQ_0MEFc2yX42w14axkQJ4gYz6WHmBYG6KA

If you already used Modeswitch, please clear data of modeswitch (Settings, Apps, Modeswitch, clear data), and then uninstall the app. After that install the new version.

As Always on the first run you have to set and save your preferred settings. To Enter Settings again you have to clear Modeswitch app data.

Changelog:

V 1.01 Increase waiting time to autoplay spotify

V 1.2:

MtcDvd can be removed from the mode circle

Mtcmusic can be removed from the mode circle

Spotify can be removed from the mode circle

You have the option to add 2 custom apps to the mode circle - Beta

Code improvements

Version 2.0:

Code Improvements

Fixed Spotify auto play

Fixed DVD not turning off while changing mode

Now opening Radio, Music, DVD, Spotify from the app drawer, respects audio focus and quits audio from other sources.

Spotify control now works regardless how was spotify started (Modeswitch, SWC Button, HU Button, App Drawer)

Please uninstall previous version before installing the new version. On the first run set the settings. You need the package name of the custom apps you would like to add ( without .apk eg for pcradio com.maxxt.pcradio