I gotta say I'm a bit surprised by the lack of ambition to get a working 4G toggle. Every phone I've had, there has always been a demand to get a working 4G toggle. Has anyone heard of anything about this? Luckily this phone gets good battery life so its not that big of a deal but it'd be nice to have for those times when your trying to really save battery.
I know of the app Phone Info, but its gotten a lot of negative views around here about losing data with it so I've avoided it since.
rehpyc has been working on one. I've sent him some info that I discovered trying to find the right system call to switch between 3g and 4g.
Rather than simply be disappointed, would you like to help?
Sent from my SCH-I535 using xda premium
I'm trying to find where the settings (which can be accessed in the phone info -> Device Information area) are stored.
-Using dex2jar and jdgui, I decompiled the phone info app into java source (.java) files. It's a really small app that just calls the "TestingSettings" functionality of the SecSettings.apk
-We can access the "TestingSettings" by simply running "am start com.android.settings/.TestingSettings" in terminal. It essentially does the exact same thing as launching the Phone Info app.
-Using dex2jar and jdgui, I decompiled the SecSettings.apk into java source (.java) files. Digging through the files, I found that the RadioInfo class. This class contains a String array mPreferredNetworkLabels which lists all the settings in the spinner we choose the network type (CDMA Auto (PRL), LTE/CDMA/EvDo, etc). This class seems to provide functionality for listening to GUI changes on the "PreferredNetworkType" spinner. Not exactly sure what it does from there, but hopefully it can be traced down to some methods that either store the settings into a file or to a SQLite database.
In dex2jar -> JD gui for SecSettings.apk, Radioinfo class has
public RadioInfo()
{
String[] arrayOfString = new String[14];
arrayOfString[0] = "WCDMA preferred";
arrayOfString[1] = "GSM only";
arrayOfString[2] = "WCDMA only";
arrayOfString[3] = "GSM auto (PRL)";
arrayOfString[4] = "CDMA auto (PRL)";
arrayOfString[5] = "CDMA only";
arrayOfString[6] = "EvDo only";
arrayOfString[7] = "GSM/CDMA auto (PRL)";
arrayOfString[8] = "LTE/CDMA/EvDo";
arrayOfString[9] = "LTE/GSM/WCDMA";
arrayOfString[10] = "Global";
arrayOfString[11] = "LTE only";
arrayOfString[12] = "LTE/WCDMA";
arrayOfString[13] = "Unknown";
this.mPreferredNetworkLabels = arrayOfString;
}
RadioInfo.java sets the network type in the following code (lines 297-309):
AdapterView.OnItemSelectedListener mPreferredNetworkHandler = new AdapterView.OnItemSelectedListener()
{
public void onItemSelected(AdapterView paramAnonymousAdapterView, View paramAnonymousView, int paramAnonymousInt, long paramAnonymousLong)
{
Message localMessage = RadioInfo.this.mHandler.obtainMessage(1001);
if ((paramAnonymousInt >= 0) && (paramAnonymousInt <= -2 + RadioInfo.this.mPreferredNetworkLabels.length))
RadioInfo.this.phone.setPreferredNetworkType(paramAnonymousInt, localMessage);
}
public void onNothingSelected(AdapterView paramAnonymousAdapterView)
{
}
};
The key line is line 303:
RadioInfo.this.phone.setPreferredNetworkType(paramAnonymousInt, localMessage);
Some info about the setPreferredNetworkType() method:
void setPreferredNetworkType(int networkType, Message response);
Requests to set the preferred network type for searching and registering (CS/PS domain, RAT, and operation mode)
Parameters:
networkType one of NT_*_TYPE
response is callback message
The phone data member is a private data member set to null on line 422:
private Phone phone = null;
The phone data member is set to the Default Phone on RadioInfo object creation (onCreate) in line 916:
this.phone = PhoneFactory.getDefaultPhone();
Based on the above information, I believe we would need to create a toggle which would execute a small java program to access the setPreferredNetworkType() method from a Phone object instantiated from the PhoneFactory.getDefaultPhone() method. I believe Phone resides in com.android.internal.telephony, but in order to gain access to the internal android stuff we would need to do something like the following article provides:
https://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-1-introduction/
That's all the time I have for the moment...
great info! Unfortunately I have no idea how that stuff works. I praise the devs who do this work and members like you who work on it. I wish I could.
Sorry if I came off as demanding of wanting a toggle, I'm just surprised I haven't heard more about it. But good to know it's being worked on. I'd definitely be willing to help test when something is cooked up though
tu3218 said:
great info! Unfortunately I have no idea how that stuff works. I praise the devs who do this work and members like you who work on it. I wish I could.
Sorry if I came off as demanding of wanting a toggle, I'm just surprised I haven't heard more about it. But good to know it's being worked on. I'd definitely be willing to help test when something is cooked up though
Click to expand...
Click to collapse
Unfortunately I'm short on time these days, but I wanted to get the info out there so someone might be able to use it. I really do think we're close, but I'm more of a hacker/modder than an Android dev. Someone comfortable with development on Android might be able to speed this up significantly.
Sent from my SCH-I535 using xda premium
Related
Hi I want to make an application using location, I found this tutorial
http://msdn.microsoft.com/en-us/library/dd938890.aspx#RetrievingLocationInformationthroughGPS
which looks very helpful but because I am new to visual studio I am having some problems.
1) is the article it says "This article includes complete sample code." but I cant find a download for all the code.
2) he only mentions referencing Microsoft.WindowsMobile.Samples.Location.dll which I have done but the class LatLong is still unknown
3) I made a sample program without the LatLong class just to experiment I get the following error on my device
"Microsoft.WindowsMobile.Samples.Location, Version=1.0.3448.25673, Culture=neutral, PublicKeyToken=null, or one of its dependencies, was not found
any idea what this means?
4) Could all my problems be because I am using visual studio 2005 and not 2008? I found a code project that looked really helpful but when trying to open it it says that it cant because it is from a newer version of the software, anything that can be done?
5) I find MSDN confusing for finding out what to reference to add a class for example this is the page for the LatLong class http://msdn.microsoft.com/en-us/library/cc514548.aspx
with the java online info the first thing you always see is where the class is found but it seems to be missing for this class. Other basig classes appear similar to java.
below is my sample code its basically taken from the article but I have commented out the references to LatLong and put in checks instead
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.WindowsMobile.Samples.Location;
namespace DeviceApplication3
{
public partial class Form1 : Form
{
private Gps gps;
int count = 0;
public Form1()
{
InitializeComponent();
gps = new Gps();
gps.Open();
}
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = (getGpsString());
}
private string getGpsString()
{
GpsPosition position = gps.GetPosition();
/*LatLong location = new LatLong();
if (position.LatitudeValid)
location.Latitude = position.Latitude;
if (position.LongitudeValid)
location.Longitude = position.Longitude;
if (position.HeadingValid)
location.Heading = position.Heading;*/
StringBuilder sb = new StringBuilder();
sb.Append("\n");
sb.Append("Latitude = ");
if (position.LatitudeValid)
{
sb.Append(position.Latitude.ToString() + "\n");
}
else
{
sb.Append("Not found yet\n");
}
sb.Append("Longitude = ");
if (position.LongitudeValid)
{
sb.Append(position.Longitude.ToString() + "\n");
}
else
{
sb.Append("Not found yet\n");
}
sb.Append("Heading = ");
if (position.HeadingValid)
{
sb.Append(position.Heading.ToString() + "\n");
}
else
{
sb.Append("Not found yet\n");
}
return sb.ToString();
}
}
}
Microsoft.WindowsMobile.Samples.Location.dll
is this file located in bin\debug and or \bin\release
?
and does it only give runtime errors or also compile time ?
no it compiles fine, can you see anything wrong with my code? The weird thing is the form comes up using the emulator but not on the device. Could it be because I have a custom rom that seems to have compact framework 3.5? I would assume it would be back compatible?
How have you deployed it to the device? Have you copied the .exe and the Location.dll?
one thing you could also test was if you could disable the stuff in the gps
and just run a program without it to verify that it's not missing net3.5's fault
heliosdev said:
How have you deployed it to the device? Have you copied the .exe and the Location.dll?
Click to expand...
Click to collapse
Hi thanks for this I didnt copy over the dll I'm very silly.
So what do you guys think about loading projects ment for vs 2008 in 2005 is this impossible ? or can i convert them somehow?
sure it's only the project and solution files which differ
add the cs files manualy and it should work fine
Use the same name to create the new project in vs2005 to have the same namespace.
You'll have to do some manual changes if the code uses c#3.0 .net 3.5 features.
Thanks guys your awesome,
very random and off topic but since your programming kings ill ask anyway,
I think I want to eventually work in the gaming industry, I'm close(3months) to finishing my MSc CompSci conversion course and I am looking for jobs, its quite aparent that most games companys don't want unexperienced people so do you guys have any ideas of places to apply for that will give the the necessary experience? btw I have no taught experience with C++ which I think is my biggest dissadvantage, I do know C and java quite well though and as you can tell just starting to play with C#.
your help is always appreciated.
well, continue with general programming (object oriented programming, ui development, database, network,...). There are so many different fields in software development!
For example take a look at the chapters of the books in the game programming gems series to see what (not only) gaming companies are working on. In general for beginning there is a lot of information online where you'll find tons of tutorials.
Try to get a profound base in programming.
Starting with your gps application, develop a gui, save/load the positions (database), visualize the points...
heliosdev said:
well, continue with general programming (object oriented programming, ui development, database, network,...). There are so many different fields in software development!
For example take a look at the chapters of the books in the game programming gems series to see what (not only) gaming companies are working on. In general for beginning there is a lot of information online where you'll find tons of tutorials.
Try to get a profound base in programming.
Starting with your gps application, develop a gui, save/load the positions (database), visualize the points...
Click to expand...
Click to collapse
Hi sorry for the late reply I upgraded to windows 7 last night to try and improve my rubbish laptop, seems to be a bit better btw,
anyway just want to say thanks for the advice. also my app will use google maps yahoo zonetag and windows live earth (or bing maps if thats what there calling it now) I think for some of thoes services I will need to pay to realease my app to the public even if its free but what about testers would I be able to give it to say 10 people?
Hey guys, I know this thread is probably better suited for the development thread, but I am not allowed to post there, so here goes:
I am working on improving the notepad app that is created through the notepad tutorial provided for android development, and at the moment I am trying to make a preferences page that allows me to enter a number, hit confirm, and the app will use that number to change the font. My approach so far has been to pass a startActivityForResult call, which returns a number, then in my onActivityResult I check for that number which should be returned. I then capture the result code, which should not be an integer, it has been parsed in the methods that were called. All that seems to be running fine, but when I try to use TextView to setTextSize my application is force closing, I have tried a few different ways of implementing this setTextSize method, including not using the variable that I am getting back (resultCode) at all, and instead just plugging in a preset number, but the application is still bombing as soon as I try to call setTextSize in any way. I wanted to see if there is anything special about the setTextSize that I may be missing, or if there is a better way of setting font size at run-time.
Thanks,
Nate
Does this help at all?
I did find that post through my searching, and even calling the setTextSize using pixels it still bombs out, here is my code for making the text larger:
fontSize = resultCode;
TextView tv;
tv = (TextView)findViewById(R.id.text1);
tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontSize);
I do not know if this matters or not, but the view that is being used is notes_row which is referenced by id text1, more importantly, notes_row is used to display the rows on the notes_list view.
Thanks for the help, I am new to android programming, and this is something I have had trouble with for the past 2 days.
OK well what does the stack trace look like? what errors are you getting? and i know you said you plugged in an actual number in place of the variable (just for testing), but how did you plug that number in? did you just use the number or did you use the Float or Integer object or what?
Unfortunately, I do not know what a stack trace is, if you could elaborate I would be very grateful.
When I plugged the number in directly I did it both by creating a variable of type float and assigning it a value, and using that variable in the method call, as well as just putting a number directly into the method call.
Bump. Can't figure out why a simple textview.settextsize would cause a force quit.
Sitrep: I figured out the problem with my code, but in the process caused another problem. Here is the deal, I was instantiating TextView with a view object, rather than a context, after switching the line that said TextView tv = new TextView( (TextView) findViewById(R.id.text1))) to TextView tv = new TextView(this). The problem with that is, I am trying to edit data that is in a pre-existing textview, declared in one of my xmls, and therefore creating a new one does not seem like the right way to be going, or maybe I just do not understand the way to do it.
Does anyone know a way for me to access my pre-existing TextView (created in my xml file) at run-time, or even a way to apply settings that I change on my new TextView to my pre-existing one. Is this possible or do I need to be looking for a different solution (someone suggested that I create a separate view for each text size that I want to create, and then once a user selects the text they want using a menu, just call the appropriate view) I would prefer to use a more elegant solution if possible.
Thanks for all the help so far,
Nate
Doing more reading, I see that I do in fact need to make my TextView = the one that is currently defined with the program, the problem with this is that when I put breakpoints right after where I declare this statement: TextView tv = (TextView) findViewById(R.id.text1); Under variables tv shows as a null, and I believe that is the reason that I getting the crash, I think the program is seeing null.setText...... instead of view.set....
To the top
I had error ArgumentNullException was unhandled when run my coding.
Code:
public class ImageConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
byte[] buffer = value as byte[];
[B]Stream memStream = new MemoryStream(buffer);[/B]
WriteableBitmap wbimg = PictureDecoder.DecodeJpeg(memStream);
return wbimg;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return null;
}
}
The bold line is where the error occur..
Any solution to this error or any other suggestion for me to retrieve image into window phone? Thank you.
Well...
Well, I guess you enter your method with value as null. Your code snippet does of course not show just why value might be null.
Pardon me this innocent question: Why don't you just take the whole thing into the debugger and watch what happens?
Either value is null, or value is not a byte[].
It would be better to just cast it to byte[] instead. That way you would get a different error if it's not a byte[], than if it's null. This would be of some diagnostic value but as another poster mentioned your best bet is to run this in a debugger to see what's going on.
save the image name in database,
Sorry, may i know how to test it in debugger mode?Thank you.
Too early?
hueikar said:
Sorry, may i know how to test it in debugger mode?Thank you.
Click to expand...
Click to collapse
I don't want to offend you, and of course you are free to do whatever you like, but I think it's too early for you to build a full and maybe complicated WP7 app. Do you know the saying "First you have to learn to crawl before you can try to walk"? I think you should learn the fundamentals of using Visual Studio and programming for WP7 from some nice book or online tutorial first.
Even working with complete code samples, as you seem to try, does not help, if you ask me. At least it always was like that when I tried it myself: If in the past I tried to get some code samples to work that I did not understand myself, the first trivial problem already stopped me dead in my tracks. I only had success after my knowledge had progressed to a point where I could read and understand the samples.
Sorry. Yes. I admit that i am too rush to do a win7 app. This is my first time doing window phone app and so with the language c#. But i kinda run out of time to do learning..My first mistake is choose wrong title to do window phone app as my final year project..Luckily so far i manage to do the CRUD for the app.but this is the most difficult problem i am facing now..
Well, in answer to your question, Visual Studio has a Debug button. Select whether you want to debug on the emulator or on your phone (the latter requires that the phone be connected to the PC and Zune be running) and give it a try. If you want to use the media library while debugging, you'll need to use the WPConnect program (it's part of the dev tools, I believe) which allows you to close Zune after you establish the connection, thus unlocking the media library on the phone.
I use my7rom on my Omnia 7.
Is there anyway to link a contacts adress to Nokia Drive instead of Maps (stock wp7 app). It would be much more practical if Nokia Drive opened a navigation session instead.
Anyone up for the challenge? A reg-tweak perhaps?
// Manneman
Skickat från Windows Phone 7.8
There's two parts here. The first is identifying the correct "filetype" or URI scheme that is used for navigation. That shouldn't be too hard; a little digging in HKCU should reveal it. We already know about ones like callto: and http: and I'm actually (slowly) working on an app to allow people to easily change them. The second part is finding the correct command to load that address or route in the Nokia Maps app. If the app supports pinning routes or destinations to Start, this is probably possible. If not, it may not be possible in the app. Most apps aren't designed to accept command-line parameters, so even if you make them the default handler for a given filetype or URI scheme, they ignore the value you send them and just start as though launched from Start.
GoodDayToDie said:
If the app supports pinning routes or destinations to Start, this is probably possible.
Click to expand...
Click to collapse
Nokia Drive supports pinning to start so it should be possible. Unfortunately I can't tell you exact command line parameters 'cause my Lumia 900 still "in jail"
Let me see if I have a copy of the Nokia Drive XAP handy. I'll need to decompile it to figure out the correct parameters for launching it with the intent of navigating to a specific location. Note also that this might not be possible directly - for example, the app might store a list of locations internally, and the tiles only provide an index into that list rather than providing the location directly - but that just requires another layer of indirection.
In that case, you create an app that gets registered as the navigation handler, and in response to a navigation request, it writes the requested location into the Nokia Drive app and then chain-launches Nokia Drive with the index of the newly written location. That's just an example of one way that this might go wrong, but overall, the odds are actually pretty good. Obviously, all of this will require, at a minimum, write access to the HKCR hive in the registry.
Ah, guys! You are so kind helping me out. I´m really certain alot of members in the WP7 section would love for this to work!
// Manneman
GoodDayToDie said:
I'll need to decompile it to figure out the correct parameters for launching it with the intent of navigating to a specific location
Click to expand...
Click to collapse
GoodDayToDie, you may try much simpler solution. Just create assembly (dll) to show startup parameters in message box, and replace main Nokia Drive dll (but pin some location first).
That's actually harder than it sounds; even if the app is sideloaded (which would mean I already have the DLL) my fake would have to mimic the internal structure of the real app to a degree (namespaces, class names, default actions, etc.). That's not hard, but decompiling .NET is pretty trivial too.
AFAIR, Nokia Drive is obfuscated (but I'm not 100% sure). Also, you don't need to duplicate all names and structures; just a stuff mentioned in WMAppManifest (I hope so). BTW, I forgot: I still have unlocked handset; if I'll found time, will try today later.
Update: tried but without of luck What I did:
- installed Nokia Drive first;
- downloaded map and pinned current location;
- created fake app with same app guid and namespace name ("Drive"), and performed app update (that operation completely override whole solution but NokiaDrive tile still pinned to the start screen);
- tried a few different page names (_default.xaml, QuickStartPage.xaml, DestinationPickerPage.xaml, FavoritesPage.xaml) with code
Code:
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
MessageBox.Show("Hello from fake dll");
if (e.NavigationMode == System.Windows.Navigation.NavigationMode.New)
{
string[] keys = NavigationContext.QueryString.Keys.ToArray();
string[] values = NavigationContext.QueryString.Values.ToArray();
string param = "";
for (int i = 0; i < keys.Length; i++)
{
param += keys[i] + " -> " + values[i] + "\n";
}
MessageBox.Show("parameters: " + param);
}
}
But result always the same: app doesn't start from the pinned tile
Update 2: Finally, I did it
The trick is:
- do the same as I've described above (you should have pinned tile from ND);
- add following code to the start page:
Code:
public MainPage()
{
InitializeComponent();
var appTile = ShellTile.ActiveTiles.Last();
if (appTile != null)
{
//MessageBox.Show(appTile.NavigationUri.OriginalString);
EmailComposeTask emailTask = new EmailComposeTask();
emailTask.Subject = "NokiaDrive pinned parameters";
emailTask.Body = appTile.NavigationUri.OriginalString;
try
{
emailTask.Show();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK);
}
}
}
- run app as usual (not from tile);
We allset - all params are sent to our email (I'm too lazy to manually copy all stuff )
Here we are (start parameters; bold values are changed for privacy reason ):
/_default?destination.name=200 SomeName Street&destination.latitude=49.5255378801376&destination.longitude=-72.4296837244183&destination.address.street=SomeName Street&destination.address.houseno=200&destination.address.district=&destination.address.county=&destination.address.city=SomeCity&destination.address.state=&destination.address.country=USA&destination.address.postcode=05720&destination.hashCode=371767793destination.address.statecode=MA&pinnedFrom=Favorites
P.S. Just found: Navigon also has ability to pin address to the start tile So, if you find the way to modify map protocol (or how it calls), it will be a really nice hack! BTW, could you remind me: do we have ability to launch assembly by GUID (on the full-/policy-unlocked phones)? If "yes", it's possible to write a real nice "proxy" app to handle map requests
I don't know about launching assemblies directly, but it's certainly possible to launch apps by GUID. It doesn't even require anything more than dev-unlock in fact (although of course you can only launch apps that you could launch anyhow). So yes, a proxy app is totally possible. That's actually what I'm working on (started as a project to make a Kindle ebook file loader, that would pur .mobi/.prc file in the Kindle app's folder and then launch the app).
GoodDayToDie, could you please, take a look to the registry, for default map protocol handler and figure out how to change that stuff? I'm pretty busy these days (and probably will be extremely busy couple of next months) but we can cooperate and create this app...
I'll investigate, but you're not the only one busy. If you've noticed a lack of software from me recently, it's due to the nex job I got some months back; I love it, but it leaves me with a lot less time for phone hacking if I want to still have a life outside of that.
With that said, this actually ties into the work I'm already doing with things like filetype handling and default browser switching. I can send you my HKCRlib, at a minimum; it's a library that simplifies interacting with HKCR, including creating backups of important values when they change, and reverting the backups.
GoodDayToDie, truly, I'm not much interested (personally) in that hack 'cause I can't use it for my Lumia 900. So it's only for the community needs but because of lack of time, I believe, we may put it on hold.
I am trying to make a self steering gear for a boat. The actuator side that moves the tiller uses an ESP8266 and rather than add a compass there along with push buttons and LCD I thought I would try to use an Android phone and send the data to the ESP over wifi.
My starting point is compass_dev from github. This gives me a variable called "azimuth" that is taken directly from the phone/tablet. I do not at this stage need to be concerned with any of the inner working about how azimuth is arrived at and can, for now, just take it as a correct value that I have to work on.
All good so far and working well. The ESP has a PID controller to know how to move the rudder and it accepts from a web page on the ESP, a number that is the angle between a locked heading and the bearing the boat is going on so any number between 180 and -180.
This number is transferred from the main compass application through a singleton into my http handling bit (dohttp). In dohttp I am connecting to my ESP with this:
protected Long doInBackground(URL... urls) {
try {
components = SingletonSession.Instance().getBearing();
URL url = new URL("http://192.168.0.57/msg?msg="+components);
// Log.e("bears", "H11 " + components);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setUseCaches(false);
connection.setDoOutput(true);
connection.setRequestMethod("PUT");
connection.setChunkedStreamingMode(0);
OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream());
out.flush();
out.close();
connection.disconnect();
}
You can see that the URL is:
http://192.168.0.57/msg?msg="+components
components is normally just the error angle (azimuth - bearing)
If I enter, for example "12" then once this URL is accepted by the ESP the URL will change to:
http://192.168.0.57/msg?msg=12&EX=Execute
So you can see that if the ESP has received correctly I can parse the URL looking for:
12&EX=Execute
If I do not get this then the ESP has missed the value.
The problem I have is that I cannot work out how to read the URL. I do realise that I can add the values to the actual page and parse the data out with a read but it seems a long winded way when just reading the URL would give me what I need if reading the URL is possible.
I am a complete beginner and this is the first java programming I have ever attempted, first use of Android Studio and have really struggled to get this far so please make the answers as simple as possible.Any input is greatly appreciated.
Please excuse me if this is not in the right place, I seem not to have permission to put it where I think it should go and this is the closest I could find that was even slightly relevant.