Related
Okay, so i asked this question a while back and didnt get much help, but I am extremely lost. My partner who before actually programmed the app put in the necessary stuff, however i dont think it works in froyo+. I am extremely new to programming in general, and i cannot for the life of me figure this out. I have even tried other codes, but they dont work. Can someone please give me a detailed description on how to make a clock widget open the alarm clock app.
BTW this is the code that we are using at the moment:
package honeycomb.clocks;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.widget.RemoteViews;
public class BlueClock extends AppWidgetProvider
{
public void onReceive(Context context, Intent intent)
{
String action = intent.getAction();
if (AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action))
{
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.blueclock);
Intent ClocksIntent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER).setComponent(new ComponentName("com.android.alarmclock", "com.android.alarmclock.AlarmClock"));
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, ClocksIntent, 0);
views.setOnClickPendingIntent(R.id.Widget, pendingIntent);
AppWidgetManager.getInstance(context).updateAppWidget(intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS), views);
}
}
}
Click to expand...
Click to collapse
Hi,
I don't know if there's a better aproach, but this is the actual code I'm using to launch the alarm:
Code:
public static final Intent alarmIntent(Context context) {
PackageManager packageManager = context.getPackageManager();
Intent alarmClockIntent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER);
// Verify clock implementation
String clockImpls[][] = {
{"HTC Alarm ClockDT", "com.htc.android.worldclock", "com.htc.android.worldclock.WorldClockTabControl" },
{"Standar Alarm ClockDT", "com.android.deskclock", "com.android.deskclock.AlarmClock"},
{"Froyo Nexus Alarm ClockDT", "com.google.android.deskclock", "com.android.deskclock.DeskClock"},
{"Moto Blur Alarm ClockDT", "com.motorola.blur.alarmclock", "com.motorola.blur.alarmclock.AlarmClock"},
{"Samsung Galaxy S", "com.sec.android.app.clockpackage","com.sec.android.app.clockpackage.ClockPackage"}
};
boolean foundClockImpl = false;
for(int i=0; i<clockImpls.length; i++) {
String packageName = clockImpls[i][1];
String className = clockImpls[i][2];
try {
ComponentName cn = new ComponentName(packageName, className);
packageManager.getActivityInfo(cn, PackageManager.GET_META_DATA);
alarmClockIntent.setComponent(cn);
foundClockImpl = true;
} catch (NameNotFoundException nf) {
}
}
if (foundClockImpl)
return alarmClockIntent;
else
return null;
}
Hope it helps!
pmduque said:
Hi,
I don't know if there's a better aproach, but this is the actual code I'm using to launch the alarm:
Code:
public static final Intent alarmIntent(Context context) {
PackageManager packageManager = context.getPackageManager();
Intent alarmClockIntent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER);
// Verify clock implementation
String clockImpls[][] = {
{"HTC Alarm ClockDT", "com.htc.android.worldclock", "com.htc.android.worldclock.WorldClockTabControl" },
{"Standar Alarm ClockDT", "com.android.deskclock", "com.android.deskclock.AlarmClock"},
{"Froyo Nexus Alarm ClockDT", "com.google.android.deskclock", "com.android.deskclock.DeskClock"},
{"Moto Blur Alarm ClockDT", "com.motorola.blur.alarmclock", "com.motorola.blur.alarmclock.AlarmClock"},
{"Samsung Galaxy S", "com.sec.android.app.clockpackage","com.sec.android.app.clockpackage.ClockPackage"}
};
boolean foundClockImpl = false;
for(int i=0; i<clockImpls.length; i++) {
String packageName = clockImpls[i][1];
String className = clockImpls[i][2];
try {
ComponentName cn = new ComponentName(packageName, className);
packageManager.getActivityInfo(cn, PackageManager.GET_META_DATA);
alarmClockIntent.setComponent(cn);
foundClockImpl = true;
} catch (NameNotFoundException nf) {
}
}
if (foundClockImpl)
return alarmClockIntent;
else
return null;
}
Hope it helps!
Click to expand...
Click to collapse
Many thanks for this!!
sndytime said:
Many thanks for this!!
Click to expand...
Click to collapse
Unfortunately it didnt help me , Im not a programmer, and I dont know what Im supposed to do with this code and my partner is pissing me off
in order to launch an external activity from an appwidget you need to set a very specific flag on the intent you broadcast. mine was for launching gmail.
Code:
Intent mailClient = new Intent(Intent.ACTION_VIEW);
mailClient.setClassName("com.google.android.gm", "com.google.android.gm.ConversationListActivity");
[B]mailClient.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);[/B]
PendingIntent onClickPending = PendingIntent.getBroadcast(context, 0, mailClient, 0);
RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.gitc_widget_html);
rv.setOnClickPendingIntent(R.id.full_widget, onClickPending);
//then update Your Appwidgets
//AppWidgetManager manager = AppWidgetManager.getInstance(context);
//manager.updateAppWidget(mAppWidgetId, rv);
and please realize that this was kinda a stub of what to do. i left alot out that was specific to my appwidget but that was needed for this to work. but the premise of creating an intent for what you want to launch then creating a pendingIntent and then attaching it to a view of your appwidget and then updating the remote view of you appwidget by using an AppwidgetManager holds true for any situation.
if you need me to elaborate then we can chat then.
-----
o and you aren't updating your appwidgets properly...
you need to get an array of all appwidgets you have and then call updateAppWidget on each like this (again, with my class names and such)
Code:
AppWidgetManager manager = AppWidgetManager.getInstance(context);
int[] ids = manager.getAppWidgetIds(new ComponentName(context, GITextCloud.class));
for (int id : ids) {
manager.updateAppWidget(id, rv);
//rv is the RemoteViews you created earlier up in the program...
//RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.gitc_widget_html);
}
pmduque said:
Hi,
I don't know if there's a better aproach, but this is the actual code I'm using to launch the alarm:
Code:
public static final Intent alarmIntent(Context context) {
PackageManager packageManager = context.getPackageManager();
Intent alarmClockIntent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER);
// Verify clock implementation
String clockImpls[][] = {
{"HTC Alarm ClockDT", "com.htc.android.worldclock", "com.htc.android.worldclock.WorldClockTabControl" },
{"Standar Alarm ClockDT", "com.android.deskclock", "com.android.deskclock.AlarmClock"},
{"Froyo Nexus Alarm ClockDT", "com.google.android.deskclock", "com.android.deskclock.DeskClock"},
{"Moto Blur Alarm ClockDT", "com.motorola.blur.alarmclock", "com.motorola.blur.alarmclock.AlarmClock"},
{"Samsung Galaxy S", "com.sec.android.app.clockpackage","com.sec.android.app.clockpackage.ClockPackage"}
};
boolean foundClockImpl = false;
for(int i=0; i<clockImpls.length; i++) {
String packageName = clockImpls[i][1];
String className = clockImpls[i][2];
try {
ComponentName cn = new ComponentName(packageName, className);
packageManager.getActivityInfo(cn, PackageManager.GET_META_DATA);
alarmClockIntent.setComponent(cn);
foundClockImpl = true;
} catch (NameNotFoundException nf) {
}
}
if (foundClockImpl)
return alarmClockIntent;
else
return null;
}
Hope it helps!
Click to expand...
Click to collapse
this isnt actually launching the clock application. you are just returning an intent that can be used to launch the clock application (still need to make a pendingIntent and attach it to a view). there is a difference and a new programmer could be very confused by this post.
other than that it looks like a nice way to find the class and package names for what clock is installed. =)
schwartzman93 said:
Unfortunately it didnt help me , Im not a programmer, and I dont know what Im supposed to do with this code and my partner is pissing me off
Click to expand...
Click to collapse
Code:
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.widget.RemoteViews;
public class Widget2 extends AppWidgetProvider
{
public void onReceive(Context context, Intent intent)
{
String action = intent.getAction();
PendingIntent pendingIntent;
if (AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action))
{
RemoteViews views = new RemoteViews(context.getPackageName(),
R.layout.widget2);
pendingIntent = PendingIntent.getActivity(context, 0,getAlarmPackage(context), 0);
views.setOnClickPendingIntent(R.id.Widget2, pendingIntent);
AppWidgetManager
.getInstance(context)
.updateAppWidget(
intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS),
views);
}
}
public Intent getAlarmPackage(Context context)
{
PackageManager packageManager = context.getPackageManager();
Intent AlarmClockIntent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER);
String clockImpls[][] = {
{ "Standard Alarm", "com.android.alarmclock",
"com.android.alarmclock.AlarmClock" },
{ "HTC Alarm ClockDT", "com.htc.android.worldclock",
"com.htc.android.worldclock.WorldClockTabControl" },
{ "Standard Alarm ClockDT", "com.android.deskclock",
"com.android.deskclock.AlarmClock" },
{ "Froyo Nexus Alarm ClockDT",
"com.google.android.deskclock",
"com.android.deskclock.DeskClock" },
{ "Moto Blur Alarm ClockDT",
"com.motorola.blur.alarmclock",
"com.motorola.blur.alarmclock.AlarmClock" },
{ "Samsung Galaxy S", "com.sec.android.app.clockpackage",
"com.sec.android.app.clockpackage.ClockPackage" } };
boolean foundClockImpl = false;
for (int i = 0; i < clockImpls.length; i++)
{
String packageName = clockImpls[i][1];
String className = clockImpls[i][2];
try
{
ComponentName cn = new ComponentName(packageName, className);
packageManager.getActivityInfo(cn,PackageManager.GET_META_DATA);
AlarmClockIntent.setComponent(cn);
foundClockImpl = true;
} catch (NameNotFoundException nf)
{
}
}
if (foundClockImpl)
{
return AlarmClockIntent;
}
else
{
return null;
}
}
}
Here is the Complete Source of my Appwidget Provider it generates a Clickevent on Appwidget to start the specific alarm app on the different phones.
Here is the Link to the simple Clock widget i have extended
Hope this helps!!
SUCCESS!!!!! Thank you guys so much, you have no idea how grateful I am for your help.
I want to make a lockscreen application, so I made simple application.
But, this is too slow. Time from being on screen to seeing my application is almost 3 seconds.
Why this app is too slow?
Here is the my code.
(this method is included in the class that inherit BroadcastReceiver)
public void onReceive(Context context, Intent intent)
{
if (intent.getAction() == Intent.ACTION_SCREEN_OFF)
{
Toast.makeText(context, "Screen is off", Toast.LENGTH_SHORT).show();
Intent i = new Intent( context, MainActivity.class );
//i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pi = PendingIntent.getActivity(context, 0, i, PendingIntent.FLAG_ONE_SHOT);
try
{
pi.send();
}
catch (CanceledException e)
{
e.printStackTrace();
}
}
}
I am currently working on an App Switcher with the ability to also add custom apps in the app switcher. So, I already got the recent apps loader built. This is the code for this part of the app:
Code:
public class Corners_RecentApps extends Activity {
private ArrayList<PanelItemDetail> rowItems = null;
private ListView listView;
private ArrayList<String> packageName = null;
private ArrayList<String> className = null;
[user=439709]@override[/user]
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
boolean rightpanel = getSharedPreferences(getPackageName() + "_preferences", Context.MODE_PRIVATE).getBoolean("panelpos_right", true);
if(rightpanel){
overridePendingTransition(R.anim.left_slide_in_fast, 0);
setContentView(R.layout.right_side_panel);
}
else
{
overridePendingTransition(R.anim.right_slide_in_fast, 0);
setContentView(R.layout.activity_left_side_panel);
}
ImageView imgbtn = (ImageView) findViewById(R.id.transparentbackground);
ImageView panelbg = (ImageView) findViewById(R.id.panelbackground);
listView = (ListView)findViewById(R.id.panelcontents);
packageName = new ArrayList<String>();
className = new ArrayList<String>();
ActivityManager am = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);
List<ActivityManager.RecentTaskInfo> tasks = am.getRecentTasks(30, 0);
rowItems = new ArrayList<PanelItemDetail>();
PackageManager pacMgr = getPackageManager();
for (ActivityManager.RecentTaskInfo recentTask : tasks) {
try {
rowItems.add(new PanelItemDetail(pacMgr.getApplicationIcon(recentTask.origActivity.getPackageName())));
packageName.add(recentTask.origActivity.getPackageName());
className.add(recentTask.origActivity.getClassName());
Log.d("#@#", "getPackageName = " + recentTask.origActivity.getPackageName());
Log.d("#@#", "getClassName = " + recentTask.origActivity.getClassName());
} catch (NameNotFoundException e) {
e.printStackTrace();
}
}
SharedPreferences myPreference = PreferenceManager.getDefaultSharedPreferences(this);
String itembg = myPreference.getString("itembg_list", "");
if(itembg.equals("defaults"))
{
PanelArrayAdapter adapter = new PanelArrayAdapter(this,R.layout.panelrow_default, rowItems);
listView.setAdapter(adapter);
}
else if(itembg.equals("dark"))
{
PanelArrayAdapter adapter = new PanelArrayAdapter(this,R.layout.panelrow_dark, rowItems);
listView.setAdapter(adapter);
}
else if(itembg.equals("light"))
{
PanelArrayAdapter adapter = new PanelArrayAdapter(this,R.layout.panelrow_light, rowItems);
listView.setAdapter(adapter);
}
else
{
PanelArrayAdapter adapter = new PanelArrayAdapter(this,R.layout.panelrow_none, rowItems);
listView.setAdapter(adapter);
}
listView.setOnItemClickListener(new OnItemClickListener() {
[user=439709]@override[/user]
public void onItemClick(AdapterView<?> parent, View view, int postion, long id) {
try{
boolean rightpanel = getSharedPreferences(getPackageName() + "_preferences", Context.MODE_PRIVATE).getBoolean("panelpos_right", true);
Intent taskintent = getPackageManager().getLaunchIntentForPackage(packageName.get(postion).toString());
startActivity(taskintent);
if(rightpanel){
overridePendingTransition(R.anim.right_slide_in, R.anim.zoom_out);
}
else
{
overridePendingTransition(R.anim.left_slide_in, R.anim.zoom_out);
}
finish();
}
catch (NullPointerException fail) {
Toast.makeText(getApplicationContext(), "!", Toast.LENGTH_SHORT).show();
}
}
});
SharedPreferences panelbgpref = PreferenceManager.getDefaultSharedPreferences(this);
String panelbgset = panelbgpref.getString("panelbg_list", "");
if(panelbgset.equals("light"))
{
panelbg.setImageResource(R.drawable.panelbg_light);
}
else
{
panelbg.setImageResource(R.drawable.panelbg);
}
imgbtn.setOnClickListener(new View.OnClickListener(){
[user=439709]@override[/user]
public void onClick(View v) {
if(v.getId() ==R.id.transparentbackground){
moveTaskToBack(true);
finish();
}
}
});
}
Now I want to let the users define in the app settings up to 3 own apps that should be shown on every moment.
How should I do that?
Thank you
Hello,
I am developing an app related to alarm service and facing an issue of Intent not being called.
I have registered for event in manifest file:
<receiver android:name="com.example.myfirstapp.EventTriggerManager" >
</receiver>
And have implemented EventTriggerManager class extended from BroadcastReceiver:
public class EventTriggerManager extends BroadcastReceiver
{
@override
public void onReceive(Context context, Intent intent)
{
System.out.println("Alarm raised");
Toast.makeText(context, "Don't panik You have an alarm!!!!.", Toast.LENGTH_LONG).show();
}
}
Adding an alarm from the Activity class:
Intent intent = new Intent(this, EventTriggerManager.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this.getApplicationContext(), 12345678, intent, 0);
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, totalTime, pendingIntent);
But alarm is not getting triggered when totalTime is reached in the system.
Note: totalTime is absolute time used.
Pls point my mistake why the expected output is not seen.
Regards,
Sunil
Sunil K said:
Hello,
I am developing an app related to alarm service and facing an issue of Intent not being called.
I have registered for event in manifest file:
<receiver android:name="com.example.myfirstapp.EventTriggerManager" >
</receiver>
And have implemented EventTriggerManager class extended from BroadcastReceiver:
public class EventTriggerManager extends BroadcastReceiver
{
@override
public void onReceive(Context context, Intent intent)
{
System.out.println("Alarm raised");
Toast.makeText(context, "Don't panik You have an alarm!!!!.", Toast.LENGTH_LONG).show();
}
}
Adding an alarm from the Activity class:
Intent intent = new Intent(this, EventTriggerManager.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this.getApplicationContext(), 12345678, intent, 0);
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, totalTime, pendingIntent);
But alarm is not getting triggered when totalTime is reached in the system.
Note: totalTime is absolute time used.
Pls point my mistake why the expected output is not seen.
Regards,
Sunil
Click to expand...
Click to collapse
use this one :
Code:
Intent myIntent = new Intent(Current.this , NotifyService.class);
AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);
pendingIntent = PendingIntent.getService(ThisApp.this, 0, myIntent, 0);
insted of :
Code:
Intent intent = new Intent(this, EventTriggerManager.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this.getApplicationContext(), 12345678, intent, 0);
mohamedrashad said:
use this one :
Code:
Intent myIntent = new Intent(Current.this , NotifyService.class);
AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);
pendingIntent = PendingIntent.getService(ThisApp.this, 0, myIntent, 0);
insted of :
Code:
Intent intent = new Intent(this, EventTriggerManager.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this.getApplicationContext(), 12345678, intent, 0);
Click to expand...
Click to collapse
My EventTriggerManager extends BroadcastReceiver and it is not service right? Correct me if wrong.
I tried with the above changes but facing error:
04-19 21:25:00.019: W/ActivityManager(885): Unable to start service Intent { flg=0x4 cmp=com.example.myfirstapp/.EventTriggerManager (has extras) }: not found
Sunil K said:
My EventTriggerManager extends BroadcastReceiver and it is not service right? Correct me if wrong.
I tried with the above changes but facing error:
04-19 21:25:00.019: W/ActivityManager(885): Unable to start service Intent { flg=0x4 cmp=com.example.myfirstapp/.EventTriggerManager (has extras) }: not found
Click to expand...
Click to collapse
sorry I copied this from an old app I made, change get service => get broadcast and the notify.class to your reciver
mohamedrashad said:
sorry I copied this from an old app I made, change get service => get broadcast and the notify.class to your reciver
Click to expand...
Click to collapse
That is what I had done right:
Intent intent = new Intent(this, EventTriggerManager.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this.getApplicationContext(), 12345678, intent, 0);
Here eventTriggerManager is my receiver class. But alarm is not recevied by application
Sunil K said:
That is what I had done right:
Intent intent = new Intent(this, EventTriggerManager.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this.getApplicationContext(), 12345678, intent, 0);
Here eventTriggerManager is my receiver class. But alarm is not recevied by application
Click to expand...
Click to collapse
Try this
PHP:
int time;
PendingIntent pi;
BroadcastReceiver br;
AlarmManager am;
br = new BroadcastReceiver() {
@Override
public void onReceive(Context c, Intent i) {
yourMethod();
//called when alarmmanager triggers pending intent
}
};
registerReceiver(br, new IntentFilter("com.your.packagename"));
pi = PendingIntent.getBroadcast(this, 0, new Intent(
"com.your.packagename"), 0);
am = (AlarmManager) (this.getSystemService(Context.ALARM_SERVICE));
if (you want repeating alarm ?) {
am.setRepeating(AlarmManager.RTC, System.currentTimeMillis(),
1000 * time, pi);
} else {
am.set(AlarmManager.ELAPSED_REALTIME,
SystemClock.elapsedRealtime() + 1000 * time, pi);
}
And please use the CODE tags, next time you want to post some code
gh0stslayer said:
Try this
PHP:
int time;
PendingIntent pi;
BroadcastReceiver br;
AlarmManager am;
br = new BroadcastReceiver() {
@Override
public void onReceive(Context c, Intent i) {
yourMethod();
//called when alarmmanager triggers pending intent
}
};
registerReceiver(br, new IntentFilter("com.your.packagename"));
pi = PendingIntent.getBroadcast(this, 0, new Intent(
"com.your.packagename"), 0);
am = (AlarmManager) (this.getSystemService(Context.ALARM_SERVICE));
if (you want repeating alarm ?) {
am.setRepeating(AlarmManager.RTC, System.currentTimeMillis(),
1000 * time, pi);
} else {
am.set(AlarmManager.ELAPSED_REALTIME,
SystemClock.elapsedRealtime() + 1000 * time, pi);
}
And please use the CODE tags, next time you want to post some code
Click to expand...
Click to collapse
Hello,
Alarms are getting received only when activity is running it is not otherwise.
Googled and tried below flag for intent :
Code:
i.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
Also applied below permissions for app:
Code:
<uses-permission android:name="android.permission.WAKE_LOCK"></uses-permission>
<uses-permission android:name="com.android.alarm.permission.SET_ALARM"></uses-permission>
But nothing worked though. Can you please help me finding solution to it?
Sunil K said:
Hello,
Alarms are getting received only when activity is running it is not otherwise.
Googled and tried below flag for intent :
Code:
i.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
Also applied below permissions for app:
Code:
<uses-permission android:name="android.permission.WAKE_LOCK"></uses-permission>
<uses-permission android:name="com.android.alarm.permission.SET_ALARM"></uses-permission>
But nothing worked though. Can you please help me finding solution to it?
Click to expand...
Click to collapse
If you want to keep it running in the background you should put that code in a background service. You can get lots of examples on google. Start the service when you want to use it. You can use boot receiver to start the service if you want the alarm intent to start every time the app boots.
Sent from my Galaxy Nexus using Tapatalk
gh0stslayer said:
If you want to keep it running in the background you should put that code in a background service. You can get lots of examples on google. Start the service when you want to use it. You can use boot receiver to start the service if you want the alarm intent to start every time the app boots.
Sent from my Galaxy Nexus using Tapatalk
Click to expand...
Click to collapse
Thank you, I will explore this more
Sunil K said:
Thank you, I will explore this more
Click to expand...
Click to collapse
good luck, post again if you face some problems.
Sent from my Galaxy Nexus using Tapatalk
Hi all
I rarely post in XDA becau I havehave nothing to share. But today I am happy to share this a little thing.
For audio of Note2 N7100, have two matters : 1)Volume limit for some local, and for others seems not limit but still small sound, not enough for a high resistance headphone which over 150Ohm. 2) Distort and include auto interrupt power (sound stop) due to Headphones volume trick (mostly from original 55dB to 57dB or 60dB and 63dB as in some kernel/app or flashzip).
Now start. We need a rooted device Note2 (also for S3, Note3, S4 ) and Root Browser app (on google market)
Use Root browser (other app can do but recommend root browser) to access
\system\etc\sound\t03g. Base on device and Android version, if not found, it will be at \system\etc\default_gain.conf
Open it and you see extractly or similar to this
And this
That's all! Those values are different from your original, I changed them.
You see 3 elements related to volume
Headphones volume
Aif1dac volume
Dac1 volume
I have read specs of DAC chip WM1811 in Note2 from maker's homepage.
All volume level of components are 96 to 100dB (means over 100 is out of range or with distortion). But, actually those value I confirmed OK : sounds bigger and better.
Headphone volume is limit at 63 on Note2, 64 will cause no sound. On high impedance HP as 300Ohm, 63 also make overpowered of sound chip and it stops player.
It is not a good item to change
Aif1dac (audio interface 1) is reduce because I want to use more volume from Dac1
(Main audio use dac1, other as call, mic, FM on aif2, dac2 if I don't misreading).
For Dac1 volume we can choose 96(original) to 128 (over that makes no sound). I run near max value and never found audio interrupted or any thing happens, not heating, no distortion.
Lastly Audio path DAC to headphone mux val. =0 (original ="mixer")
Test it and feel. Have fun!
This was really useful, thank you.
I changed the values for headset, headphones and aux DAC. I'm happy with analogue dock out, speaker, in-call values etc. and I don't use a bluetooth headset. I also didn't change any of the loop values as I'm sure Samsung know much better than me about this stuff as I know nothing!
Original headset values:
Code:
Modifier "Normal" {
SupportedDevice {
"Headset Out"
}
Enable {
{ "Headphone ZC Switch", 0 },
{ "AIF1DAC1 Volume", 96 },
{ "AIF1 Boost Volume", 0 },
{ "DAC1 Volume", 96 },
{ "Left Output Mixer DAC Volume", 7 },
{ "Right Output Mixer DAC Volume", 7 },
{ "Headphone Volume", 49 },
}
Disable {
{ "Headphone ZC Switch", 0 },
{ "AIF1DAC1 Volume", 96 },
{ "AIF1 Boost Volume", 0 },
{ "DAC1 Volume", 96 },
{ "Headphone Volume", 50 },
}
}
New headset values:
Code:
Modifier "Normal" {
SupportedDevice {
"Headset Out"
}
Enable {
{ "Headphone ZC Switch", 0 },
{ "AIF1DAC1 Volume", 100 },
{ "AIF1 Boost Volume", 0 },
{ "DAC1 Volume", 100 },
{ "Left Output Mixer DAC Volume", 7 },
{ "Right Output Mixer DAC Volume", 7 },
{ "Headphone Volume", 63 },
}
Disable {
{ "Headphone ZC Switch", 0 },
{ "AIF1DAC1 Volume", 100 },
{ "AIF1 Boost Volume", 0 },
{ "DAC1 Volume", 100 },
{ "Headphone Volume", 63 },
}
}
Headphone changes are as above.
Original AUX Digital Out values:
Code:
Modifier "Normal" {
SupportedDevice {
"AUX Digital Out"
}
Enable {
{ "AIF1DAC1 Volume", 96 },
}
Disable {
{ "AIF1DAC1 Volume", 96 },
{ "AIF1 Boost Volume", 0 },
{ "DAC1 Volume", 96 },
{ "SPKL DAC1 Volume", 1 },
{ "SPKR DAC1 Volume", 1 },
{ "Speaker Mixer Volume", 0 },
{ "Speaker Volume", 57 },
{ "Speaker Boost Volume", 0 },
}
}
New AUX Digital Out values:
Code:
Modifier "Normal" {
SupportedDevice {
"AUX Digital Out"
}
Enable {
{ "AIF1DAC1 Volume", 100 },
}
Disable {
{ "AIF1DAC1 Volume", 100 },
{ "AIF1 Boost Volume", 0 },
{ "DAC1 Volume", 100 },
{ "SPKL DAC1 Volume", 1 },
{ "SPKR DAC1 Volume", 1 },
{ "Speaker Mixer Volume", 0 },
{ "Speaker Volume", 63 },
{ "Speaker Boost Volume", 0 },
}
}
I rebooted and checked with Samsung HS330 headset, a standard headphone (no mic or call controls) and also with my FiiO E7 USB DAC/Amp connected via USB OTG cable. I get a convenient volume increase in each case, no extra system noise, no audible distortion and nothing went wrong ...so far.
Rocking on Dr. Ketan V14. Thanks a Ton !!!